[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Smoothing a roughly sinusoidal signal

From: llrjt100
Subject: Re: Smoothing a roughly sinusoidal signal
Date: Fri, 8 Nov 2019 05:58:06 -0600 (CST)

Thanks for your suggestion - I'd like to give this a try. 

I'm very new to signal processing - how do I go about finding parameters a &

I've adapted an example I found on the web, but not really sure what I'm

data = csvread('sidvel.csv');

t = data(:,1);
a = data(:,2);
s = data(:,3);
d = data(:,4);


%function with parameters
%fun = @(t,p) p(1)*sin(p(2)*t+p(3)) + p(4);  % sine wave with 4 parameters
to estimate
fun = @(t,p) p(1)*sin(p(2)*t) + p(3)*cos(p(2)*t); %a*sin(kt) + b*cos(kt)
fcn = @(p) sum((fun(t,p)-a).^2);  %Cost function to minimize the sum of the

%Initial guess for parameters
p0 = [4 0 0 0];

%Parameter optimization
par = fminsearch(fcn, p0);

%See if estimated parameters match measured data
yest = fun(t, par)

Sent from:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]