#1
|
|||
|
|||
MATLAB Help
I'll post the code first then explain what I want:
<font class="small">Code:</font><hr /><pre> <font color="blue">if</font> ??? F=laplace(e); <font color="blue">else</font> F=e; <font color="blue">end</font></pre><hr /> My problem is where the question marks are. I want to essentially say: if e is a function of t then perform the laplace transform on e, if not then F is just equal to e. Is there a way to ask if e is a function of t? Such as if I input before the above if statement: syms t e=exp(t) Then I want Matlab to recognize e is dependent on t and then to perform Laplace. On the other hand if I say e=0 I want Matlab to just set F=e Thank you |
#2
|
|||
|
|||
Re: MATLAB Help
Findsym lists the variables for you.
A simple hack is: if diff(e,'t')~=0; F=laplace(e); else F=e; end |
#3
|
|||
|
|||
Re: MATLAB Help
[ QUOTE ]
Findsym lists the variables for you. A simple hack is: if diff(e,'t')~=0; F=laplace(e); else F=e; end [/ QUOTE ] Makes perfect sense. Thank you very much. |
|
|