MATLAB 数学基础题 求解
3个回答
展开全部
1 a=rand(4,5)
a =
0.9501 0.8913 0.8214 0.9218 0.9355
0.2311 0.7621 0.4447 0.7382 0.9169
0.6068 0.4565 0.6154 0.1763 0.4103
0.4860 0.0185 0.7919 0.4057 0.8936
>> max(a(:))%%最大值
ans =
0.9501
>> [x,y]=find(a==max(a(:)))%%找a矩阵中散歼槐元素的最大冲友值,并输出其坐标
x =
1
y =
1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 n=20;
sum=0;
for i=1:n
sum=sum+factorial(i);%%阶乘累加和
end
sum
sum =
2.5613e+018
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 >> y=1:0.1:2
y =
1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 1.9000 2.0000
>>改肆 x=1:11
x =
1 2 3 4 5 6 7 8 9 10 11
>> f=x.^2+sin(x.*y)+2*y
f =
3.8415 7.0085 10.9575 17.7165 28.4570 39.4121 51.2208 68.2592 84.1276 103.9499 124.9911
a =
0.9501 0.8913 0.8214 0.9218 0.9355
0.2311 0.7621 0.4447 0.7382 0.9169
0.6068 0.4565 0.6154 0.1763 0.4103
0.4860 0.0185 0.7919 0.4057 0.8936
>> max(a(:))%%最大值
ans =
0.9501
>> [x,y]=find(a==max(a(:)))%%找a矩阵中散歼槐元素的最大冲友值,并输出其坐标
x =
1
y =
1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 n=20;
sum=0;
for i=1:n
sum=sum+factorial(i);%%阶乘累加和
end
sum
sum =
2.5613e+018
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 >> y=1:0.1:2
y =
1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 1.9000 2.0000
>>改肆 x=1:11
x =
1 2 3 4 5 6 7 8 9 10 11
>> f=x.^2+sin(x.*y)+2*y
f =
3.8415 7.0085 10.9575 17.7165 28.4570 39.4121 51.2208 68.2592 84.1276 103.9499 124.9911
展开全部
%例辩搜祥子——求漏搭阶乘
clear
a=zeros(1,20);
sum=0;
for n=1:20
a(n)=factorial(n);
sum=sum+a(n);
end
sum
%例子——求函数值
clear
syms x y
f=x^2+sin(x*y)+2*y;
x=input('x='携搏)
y=input('y=')
f=subs(f,'x',x);
f=subs(f,'y',y)
clear
a=zeros(1,20);
sum=0;
for n=1:20
a(n)=factorial(n);
sum=sum+a(n);
end
sum
%例子——求函数值
clear
syms x y
f=x^2+sin(x*y)+2*y;
x=input('x='携搏)
y=input('y=')
f=subs(f,'x',x);
f=subs(f,'y',y)
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
前两题你用一个大循环包含一个小循环写就可以了,这里写起来麻烦就不写了。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询