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.

 採用された回答

Star Strider
Star Strider 2018 年 2 月 4 日

0 投票

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 件のコメント

Michelle Babak
Michelle Babak 2018 年 2 月 4 日
thank you very much!
Star Strider
Star Strider 2018 年 2 月 4 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

質問済み:

2018 年 2 月 4 日

編集済み:

2018 年 2 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by