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
Adam Sabah
Adam Sabah 2019년 11월 5일
편집: Adam Sabah 2019년 11월 5일
This is the matlab code that i have constructed. It ran earlier but now i can not seem to figure out what the issue is.
Steven Lord
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
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

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by