网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容 知识问答

matlab的 for循环求和

时间:2024-10-12 01:46:48

1、首先下载,安装matlab,如图。

matlab的 for循环求和

3、计算1,2,3。。。n的和。

function Y=qiuhe(n)

% 计算n个整数的和

Y=0;

for i=1:n

Y=Y+i;

end

end

matlab的 for循环求和

5、for a = [20,29,27,23,28,67,18]

disp(a)

end

matlab的 for循环求和

© 2025 小知经验
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com