Perform discrete-time integration in MATLAB script
Mostrar comentarios más antiguos
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
Respuestas (2)
waqar mehboob
el 1 de Nov. de 2018
0 votos
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
Preksha
el 17 de Jul. de 2024
0 votos
% Define the input signal and parameters t = 0:0.01:10; % Time array (s) Vin = sin(2*pi*10*t); % Input signal (V) R = 1000; % Resistance (Ohms) C = 0.01; % Capacitance (F) dt = t(2) - t(1); % Time step
% Define the op-amp integrator model num = [-R/C]; den = [1 R*C dt]; H = tf(num, den);
% Simulate the output signal Vout = lsim(H, Vin, t);
% Plot the input and output signals plot(t, Vin, t, Vout); xlabel('Time (s)'); ylabel('Voltage (V)'); title('Op-Amp Integrator'); legend('Input', 'Output');
Categorías
Más información sobre Digital Filter Analysis en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!