7.求500个元素的随机数向量A中大于0.5的元素个数.怎么用matlab做这道题啊,
人气:281 ℃ 时间:2020-02-06 01:14:53
解答
试试这样:
clear all;clc;
A=rand(1,500);
sum=0;
for ii=1:length(A)
if A(ii)>0.5
sum=sum+1;
end
end
sum
推荐
猜你喜欢
- Do you think everything that he said was ture?句中的that可以省略吗?
- 修一条公路,第一天修全长的5分之2,第二天修了80米,剩下10米未修,这条公路长多少米?
- 英语翻译
- especial special particular
- 一袋大米,第一周吃了12千克,第二周吃了13千克,两周一共吃了袋大米的4分之1.这袋大米原来有多少千克?
- 这是我第一次乘船离开上海 咋翻译 ,是否:This is my first time to take a boat to leave shanghai.
- (x-y)^3*(x-y)^2*(y-x)这道题怎么算
- 在△ABC中,已知(a+b)/a=sinB/(sinB-sinA),且cos(A-B)+cosC=1-cos2C,试确定△ABC的形状.