How can I write this code in matlab and have it run? ( all variables have been defined but it keeps giving me an error on this line)
1 回表示 (過去 30 日間)
古いコメントを表示
ue = 1-4*sin((3*pi*x)/(2*L))*exp(-tmax(A/B))+4*sin((7*pi*x)/(2*L))*exp(-tmax(C/B))
3 件のコメント
Steven Lord
2019 年 11 月 5 日
What is the full and exact text of the error message you receive? Show all the text displayed in red as that might tell us exactly how to correct the error.
回答 (1 件)
Robert U
2019 年 11 月 5 日
Hi Adam Sabah,
when I run your code I get this error message:
ue = 1-4*sin((3*pi*x)/(2*L))*exp(-tmax(A/B))+4*sin((7*pi*x)/(2*L))*exp(-tmax(C/B));
!! Subscript indices must either be real positive integers or logicals.
Matlab tries to evaluate the expressions "tmax(A/B)" and "tmax(C/B)" as vector tmax at index A/B and C/B respectively. Since A/B and C/B are real numbers and not integers Matlab cannot determine the indices, despite the fact that tmax is scalar, and defined as 25. I assume you are missing multiplication signs.
Kind regards,
Robert
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!