フィルターのクリア

Inverse Laplace working in command window but not in editor

3 ビュー (過去 30 日間)
Tyler Luzar
Tyler Luzar 2020 年 3 月 9 日
回答済み: Gouri Chennuru 2020 年 3 月 12 日
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)

回答 (1 件)

Gouri Chennuru
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!

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by