How do i make this form with matrix ?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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]
0 comentarios
Respuesta aceptada
Voss
el 1 de Abr. de 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 comentarios
Más respuestas (1)
KSSV
el 1 de Abr. de 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
Ver también
Categorías
Más información sobre Time Series en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!