Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Other Topics > Science, Math, and Philosophy
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-16-2007, 10:41 AM
_brady_ _brady_ is offline
Senior Member
 
Join Date: Jan 2005
Posts: 1,707
Default 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
Reply With Quote
  #2  
Old 09-16-2007, 10:57 AM
Andy Ross Andy Ross is offline
Senior Member
 
Join Date: Jul 2005
Location: South of Heaven
Posts: 287
Default 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
Reply With Quote
  #3  
Old 09-16-2007, 11:04 AM
_brady_ _brady_ is offline
Senior Member
 
Join Date: Jan 2005
Posts: 1,707
Default 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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:56 PM.


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