why do i get "invalid parameter list"?

6 ビュー (過去 30 日間)
mario  hernandez
mario hernandez 2016 年 11 月 1 日
コメント済み: Image Analyst 2016 年 11 月 1 日
The problem.... I need to vary H that goes from 0 to 1 with 1000 points of discretion. Then calculate my moyenne (magnetization median) and plot it in function of H. All parameters are in my code. but it give me an error in the way i write my moyenne equation. See code
function moyenne=M(1-(1/sinh(J/2*kb*T).^4))^1/8;
plot(H,M)
Please help!!!

採用された回答

Image Analyst
Image Analyst 2016 年 11 月 1 日
That's not proper syntax. You're trying to both call and declare a function simultaneously. You can't do that.
Try it this way
H = linspace(0, 1, 1000);
moyenne = M(1-(1 ./ sinh(J ./ 2*kb*T).^4)) .^ (1/8);
plot(H, moyenne)
I'm still not sure about that weird expression. Hopefully J or T or M has 1000 elements. If M is an array rather than some other function, then you need to make sure the expression inside is non-zero, non-negative, and non-fractional numbers. And I don't see how H is involved in any way in your expression for moyenne. So I still think it won't work until you define what things are properly.
  2 件のコメント
mario  hernandez
mario hernandez 2016 年 11 月 1 日
編集済み: mario hernandez 2016 年 11 月 1 日
H is inside my function M=Ising2D(J,H,beta,N,Nreal) (the first line on my code, which is attach to the question) I used H= 0:0.001:1; then i change the moyenne equation the way you told me.. but now it give me another error in line 67... (see code) which is the definition to accept the condition.
thanks for your answer
Image Analyst
Image Analyst 2016 年 11 月 1 日
Why are J,H,beta,N, and Nreal in the argument list when you just overwrite what the user passed in for them with your own values?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by