How to find matrix dimensions while using * operator ?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
i was trying to plot this equation Nw=10(50+(7.5(w)1/2))+20log10(f)40log10(f+0.4))Nwoff, i got the below error.
f=200:100:200000;
Nwoff=1:10;
for n=Nwoff
Nw=10.^((50+(7.5*1/2))+20*log10(f).^40*log10(f+0.4))*n;
plot(f,Nw)
hold on
end
Error using * Inner matrix dimensions must agree.
thank you in advance.
0 comentarios
Respuestas (1)
Roger Stafford
el 16 de Feb. de 2017
Your error lies in the expression
20*log10(f).^40*log10(f+0.4)
Here you are using matrix multiplication on two thousand-element row vectors, and that is a no-no. Undoubtedly you meant
20*log10(f).^40.*log10(f+0.4)
with a dot before the asterisk sign.
Your plot will be filled with ten different thousand-point curves with this correction.
0 comentarios
Ver también
Categorías
Más información sobre 2-D and 3-D Plots 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!