×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to generate the Typical impulse wave in Matlab ?

How to generate the Typical impulse wave in Matlab ?

How to generate the Typical impulse wave in Matlab ?

(OP)
Hi all again,

To generate a typical impulse wave the code I wrote was this and could not get the required shape.

V=1;
T = 0:1e-7:tf;
i = 1;
for t = 0:1e-7:tf,
    if t <= tr
       X(i) = V * (1-exp(-t/tr));
    else
        if X(i) > (0.75*V)
           X(i) = V * (exp(-t/(tf-tr)));
        end
    end
    i = i + 1;   
end

T = T';
X = X';

plot(T,X);
------------------------------------------------------------
What some people tell me is that there is a in-built fn to do the above, please let me know if there is any.

The people who told me r quite busy and r my seniors,so can't force them u know...

Thanks,
H

RE: How to generate the Typical impulse wave in Matlab ?

H

  I can't follow what your code is trying to do, so it is hard to fix.  But... below is a rewrite that runs.  Also, I think you are calculaing the impulse response to an ODE.  For a different type of solution, you could look at ODE solvers, or the impulse function in the control system toolbox.  Also, at the command prompt, you can enter "lookfor impulse" to see what type of built in impulse solvers you have available.

John

function test1
tf=1e-6;   % Add definition of tf
tr=3e-7;   % Add definition of tr
V=1;
T = 0:1e-7:tf;
i = 1;
for t = 0:1e-7:tf,
    if t <= tr
       X(i) = V * (1-exp(-t/tr));
    else
        X(i) = V * (1-exp(-t/tr));     % Add definition of X(i)
        if X(i) > (0.75*V)             % Need value of X(i)
           X(i) = V * (exp(-t/(tf-tr)));
        end
    end
    i = i + 1;
end

T = T';
X = X';

plot(T,X);


 

RE: How to generate the Typical impulse wave in Matlab ?

(OP)
Hey,
Thanx a lot for the solution but it does not reach 1 on the rise and does not reach 75% of the value in the end (i.e. fall time)

Any suggestions...

Also please help me out in the other query (regarding work space)

I'd be really greatful to u.

Thanx,
H

RE: How to generate the Typical impulse wave in Matlab ?

(OP)
Hey,
Thanx a lot for the solution but it does not reach 1 on the rise and does not reach 75% of the value in the end (i.e. fall time)

Any suggestions...

Also please help me out in the other query (regarding work space)

I'd be really greatful to u.

Thanx,
H

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources