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]);
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
CODE
x(-1) = 0;
y(-1) = 0;
y = mydiffeq(n);
y1 = mydiffeq([0,n]);
BsK