How do i make this form with matrix ?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/949074/image.jpeg)
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]
0 Kommentare
Akzeptierte Antwort
Voss
am 1 Apr. 2022
A = work5(0.5);
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
2 Kommentare
Weitere Antworten (1)
KSSV
am 1 Apr. 2022
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
Siehe auch
Kategorien
Mehr zu Time Series finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!