How do I convert this integral equation to matlab code?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!