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.

 Respuesta aceptada

Star Strider
Star Strider el 4 de Feb. de 2018
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 comentarios

Michelle Babak
Michelle Babak el 4 de Feb. de 2018
thank you very much!
Star Strider
Star Strider el 4 de Feb. de 2018
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 4 de Feb. de 2018

Editada:

el 5 de Feb. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by