Can somebody tell me why I am getting an error while using the subs function?
조회 수: 1 (최근 30일)
이전 댓글 표시
IC=input('Enter the initial conditions in the form [y(0),Dy(0)]'); y(0)=IC(1); dy0=IC(2); LTY= subs(LTY, {'laplace(y(t), t, s)','y(0)','D(y)(0)'}, {Y,y0,dy0});
댓글 수: 0
채택된 답변
Steven Lord
2021년 5월 28일
In general when asking for help with an error you should show the full and exact text (everything displayed in red in the Command Window) of the error message you receive when you run the code. But in this case one problem is obvious.
y(0)=IC(1);
There's no such thing as element 0 of an array in MATLAB. From the context of the rest of the code I think you wanted to write:
y0=IC(1);
There may be other problems, and if there are please show us the contents of the LTY and Y variables as well as what you entered at the input prompt for the initial conditions.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Numbers and Precision에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!