Perform discrete-time integration in MATLAB script

14 Ansichten (letzte 30 Tage)
John
John am 30 Jul. 2014
Beantwortet: waqar mehboob am 1 Nov. 2018
Hi,
I would like to implement discrete-time integration of input signal in MATLAB script. For example, input signal is array x[k] for x(t)=Xsinwt
If frequency is f=10 Hz I can chose T=0.003 sec. When I tried with discrete-time integration (x-input, y-output)
y[n]=y[n-1]+0.5*T*(x[n]+x[n+1]), n>0, T=0.003
I changed a lot of y[0]=IC, but with no success. Do you know what can be the problem and how to determine IC automatically, because input signal can be in wide range of different types.
Tigar

Antworten (1)

waqar mehboob
waqar mehboob am 1 Nov. 2018
You can use this script to help solve your problem. clc figure(close) % Simple Sine wave t=0:0.01:10; y=sin(2*t); plot (y) hold on; % Discrete time integration y1(1)=0; K=1; x(1)=0; T=0.015; for n=1:length(t) x(n+1) = x(n) + K*T*y(1,n); y1(n) = x(n); end plot(y1); grid on

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by