Inverse Laplace working in command window but not in editor
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi there, I am writing a script to solve laplace and inverse laplace functions. When I call the inverse laplace function in the command window, it works fine. However, when I call it in the script itself, it does not seem to work. Anyone have any ideas? Below is my code.
Script code:
%---- Inverse Laplace Solver ----%
%------------DOESN'T WORK--------%
clear all
prompt = "What do you not want to do?:";
f = input(prompt);
syms s t
ilaplace(f)
Command window code:
>> ilaplace(1/(s-4))
ans =
exp(4*t)
댓글 수: 0
답변 (1개)
Gouri Chennuru
2020년 3월 12일
Change the script code to
clear all
syms s t
prompt = "What do you not want to do?:";
f = input(prompt);
ilaplace(f)
f is an input to the “ilaplace” function and this input should be specified as a symbolic expression, symbolic function, symbolic vector or symbolic matrix.
clear all at the beginning will clear the entire workspace and before you take the input f from the user the independent variable s and Transformation variable t should be defined.
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!