×
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

m file and differential equation

m file and differential equation

m file and differential equation

(OP)
Hi,

I'm new to matlab and I'm trying to figure out how to define and execute differential equations in matlab, for example, how would you define the following equation:

y(n) = x(n) + 2 x(n ? 1) ? 0.95 y(n ? 1)

this is to implement an input signal that is N-samples long, so I guess its (0 [less than or equal to] n [less than or equal to] N [less than or equal to] ?1) but indexing in matlab starts at 1 not 0...this is what I have thus far, can anyone help me out? Thank you

function y = mydiffeq(n)

x(-1) = 0;
y(-1) = 0;


y = mydiffeq(n);
y1 = mydiffeq([0,n]);

RE: m file and differential equation

The formating of you post is off on my computer so I am not exactly certain how to answer your question. Try reading this as it might help. If it doesnt maybe post your code so that members of this forum can see what is going on, but be sure to post it with in the "

CODE

unction y = mydiffeq(n)

x(-1) = 0;
y(-1) = 0;


y = mydiffeq(n);
y1 = mydiffeq([0,n]);
" tags and then refer to lines where you have questions. Also tell us what mydiff is.

BsK

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