How do I convert this integral equation to matlab code?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
John Doe
am 30 Mär. 2015
Beantwortet: Torsten
am 30 Mär. 2015
I'm trying to write a matlab program for a Lock-in Amplifier, based on this equation:
where Fref is the frequency you're trying to extract, t the current time sample, T the total time, Fin the input signal and phi is the phase. Reference: http://en.wikipedia.org/wiki/Lock-in_amplifier
When it comes to the integration I'm stuck. My phase is 0, my time is 4.8828 seconds incrementing in 0.002 second steps per signal sample.
sigRef = 25;
mult = 2*pi*sigRef;
t=[0:1/512:4.8828];
Uin = trialDataL; % same length as t
fun = @(x) sin(mult*t(x)*Uin(x));
q = integral(fun,1,2)
"Integral" doesn't like using x as an index instead of a numeric value, but I don't know how to get t and Uin to both change samples at the same time.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation 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!