Borrar filtros
Borrar filtros

equation of a line to a vector of samples

2 visualizaciones (últimos 30 días)
Nicholas Jacobs
Nicholas Jacobs el 13 de Feb. de 2016
Editada: Geoff Hayes el 13 de Feb. de 2016
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

Respuestas (0)

Categorías

Más información sobre Denoising and Compression en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by