Error: Inner matrix dimensions must agree.
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
[EDIT: Fri Jun 10 17:09:13 UTC 2011 - Reformat - MKF]
My Code
chuky=240*10^-6;
biendo=24;
k=[1:20];
omega=2*pi/chuky;
omega1=omega*k;
a0=2*chuky/pi;
a1=chuky*biendo./((k+1)*pi);
a2=2*sin((k+1)*pi/2);
a3=chuky*biendo./((k-1)*pi);
a4=2*sin((k-1)*pi/2);
ak=a1.*a2+a3.*a4;
t=[-0.0005:0.000001:0.0005];
u10=a0;
for i=1:10;
u10=u10+ak(i)*cos(i*omega1*t);
end
plot(t,u10);
My error
Error in ==> ltm2 at 25
for i=1:10;u10=u10+ak(i)*cos(i*omega1*t);end;
Respuestas (1)
Matt Fig
el 10 de Jun. de 2011
omega1 is 1x20
t is 1x1001
How do you recommend to multiply them??
You could use this:
u10 = a0 + sum(bsxfun(@times,ak,cos(bsxfun(@times,omega1,t.'))),2)
but because a3 divides by zero, you introduce a nan which propigates through the whole array...
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!