Why do i keep getting this," Incorrect use of '=' operator." error?

this is my code:
function z=fxy(M,N)
z=0;
for m=1:M & n=0:N
z = z+ ((10^5)*sin(x*y))+ ((((-1)^m)/(m^3))*(x.^m))+ ((y^n)/(factorial(n)));
end
alpha=linspace(-2,2,120);
beta=linspace(0,3,88);
[alpha,beta]=meshgrid(alpha,beta);
Z=fxy(20,25); //the error occurs here.
what do i do?

 採用された回答

James Tursa
James Tursa 2020 年 5 月 7 日
編集済み: James Tursa 2020 年 5 月 7 日

0 投票

This is not valid MATLAB syntax:
for m=1:M & n=0:N
Maybe you wanted nested for loops?
for m=1:M
for n=0:N
z = z+ ((10^5)*sin(x*y))+ ((((-1)^m)/(m^3))*(x.^m))+ ((y^n)/(factorial(n)));
end
end
Where is this function getting x and y from?

1 件のコメント

Rafael Hernandez-Walls
Rafael Hernandez-Walls 2020 年 5 月 7 日
編集済み: Rafael Hernandez-Walls 2020 年 5 月 7 日
and this part of code:
alpha=linspace(-2,2,120);
beta=linspace(0,3,88);
[alpha,beta]=meshgrid(alpha,beta);
Z=fxy(20,25);
in other file

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

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by