Two Plus Two Newer Archives

Two Plus Two Newer Archives (http://archives1.twoplustwo.com/index.php)
-   Science, Math, and Philosophy (http://archives1.twoplustwo.com/forumdisplay.php?f=49)
-   -   MATLAB Help (http://archives1.twoplustwo.com/showthread.php?t=502217)

_brady_ 09-16-2007 10:41 AM

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

Andy Ross 09-16-2007 10:57 AM

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

_brady_ 09-16-2007 11:04 AM

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.


All times are GMT -4. The time now is 02:50 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.