equation of a line to a vector of samples
조회 수: 2 (최근 30일)
이전 댓글 표시
So I start with -8375*t+15707, an equation of a line named wi- where t is symbolic.
I have to then integrate the line eq, eventually making a quadratic eq, which then is named psi.
I then have to replace t (sym) , with tt - a vector of time values, we'll call psiTT.
psiTT then has to be plugged into a complex exp func where I only want the real values named xx.
THe above var names aren't in my code, I put them there for sake of explanation.
I had quite a bit of trouble using symbolic means to create the quadratic equation needed. The use of double vs Vpa is still foggy and the time required to compute the xx vector took about a minute-min.5 before it spit out what I wanted.
My question is, is there a more efficient way to obtain the desired results.
function [ xx,tt ] = mychirp( f1, f2, dur, fsamp )
%MYCHIRP generate a linear-PM chirp signal
% usage: xx = mychirp(f1, f2, dur, fsamp)
% fi = starting frequency
% f2 = ending frequency
% dur = total time duration
% fsamp = samplping freq (Optional : default is 11025)
%
% xx = (vector of) samples of the chirp signal
% tt = vector of time instants for t = 0 to t = dur %
if (nargin < 4)
fsamp = 11025;
end
dt = 1/fsamp;
tt = 0 : dt : dur;
syms t
slope = ((f2-f1)/dur);
wiA =vpa((2*pi*slope* t) + 2*pi*f1);
psiS = vpa(int(wiA,t));
digits(3)
psiQ=vpa(expand(psiS));
psiF = vpa(subs(psiQ,tt));
xx = real( 7.7*exp(1i*(psiF)) );
end
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Denoising and Compression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!