How do i make this form with matrix ?

2 次查看(过去 30 天)
i want to make form like this picture with code.
(first a in forloop is series a, second a in forloop is series b, third a is seriesc)
and i got syntax error.
error
>> A=work5(0.5)
error: parse error near line 21 of file C:\Users\workspace\work5.m
syntax error
>>> fprintf('y-sum series a) series b) series c); %d %d %d',y,A]
^
could you check my code?
function A=work5(x)
m=1;
for k=10:10:160
n=1:k;
a= sum(nthroot(n.^2,5)./((3.^n).*(n+1)));
A(1,m)=a;
a= sum((3*n.^2+n)/(2*n.^4+nthroot(n,2)));
A(2,m)=a;
a= sum((nthroot(37,2)*n.^3)/((2*n.^3)+(3*n.^2)));
A(3,m)=a;
m=m+1;
end
y=[10:10:160]
fprintf('y-sum series a) series b) series c); %d %d %d',y,A]

采纳的回答

Voss
Voss 2022-4-1
A = work5(0.5);
y-sum series a) series b) series c) 10-sum 0.23609170 0.01834773 2.60371306 20-sum 0.23609351 0.00469013 2.80141626 30-sum 0.23609351 0.00210244 2.87601971 40-sum 0.23609351 0.00118798 2.91522735 50-sum 0.23609351 0.00076243 2.93940338 60-sum 0.23609351 0.00053046 2.95580253 70-sum 0.23609351 0.00039026 2.96765763 80-sum 0.23609351 0.00029910 2.97662765 90-sum 0.23609351 0.00023652 2.98365156 100-sum 0.23609351 0.00019171 2.98930074 110-sum 0.23609351 0.00015852 2.99394282 120-sum 0.23609351 0.00013326 2.99782508 130-sum 0.23609351 0.00011359 3.00111997 140-sum 0.23609351 0.00009797 3.00395140 150-sum 0.23609351 0.00008537 3.00641075 160-sum 0.23609351 0.00007505 3.00856683
function A=work5(x)
m=1;
y = 10:10:160;
for k = y
n=1:k;
a= sum(nthroot(n.^2,5)./((3.^n).*(n+1)));
A(1,m)=a;
a= sum((3*n.^2+n)/(2*n.^4+nthroot(n,2)));
A(2,m)=a;
a= sum((nthroot(37,2)*n.^3)/((2*n.^3)+(3*n.^2)));
A(3,m)=a;
m=m+1;
end
fprintf('y-sum\t\t%-10s\t%-10s\t%-10s\n','series a)','series b)','series c)');
fprintf('%-d-sum\t\t%10.8f\t%10.8f\t%10.8f\n',[y; A]);
end

更多回答(1 个)

KSSV
KSSV 2022-4-1
A = work5() ;
function A=work5()
m=1;
for k=10:10:160
n=1:k;
a= sum(nthroot(n.^2,5)./((3.^n).*(n+1)));
A(1,m)=a;
a= sum((3*n.^2+n)/(2*n.^4+nthroot(n,2)));
A(2,m)=a;
a= sum((nthroot(37,2)*n.^3)/((2*n.^3)+(3*n.^2)));
A(3,m)=a;
m=m+1;
end
y=10:10:160 ;
fprintf('y-sum series a) series b) series c); %d %d %d',y,A)
end

类别

Help CenterFile Exchange 中查找有关 Time Series 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by