Problem with dimensions using meshgrid

Not sure why my code isn't working
>> [x,y]=meshgrid(-100:1:100, -100:1:100)
>> z = (-4.3461.*(10.^-7)).*[1/[1 + ((x.^2)./(30^2))].^1.5];
Error using /
Matrix dimensions must agree.

 Risposta accettata

You need to vectorise every multiplication, division, and exponentiation:
z = (-4.3461.*(10.^-7)).*[1./[1 + ((x.^2)./(30^2))].^1.5];
VECTORISE HERE AS WELL

2 Commenti

thank you very much!
As always, my pleasure!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by