New Reply

MATLAB: Fitting a convolution

 
Share Thread Thread Tools
Jun8-12, 12:40 AM   #1
 

MATLAB: Fitting a convolution


Hi

I have the following piece of code:

Code:
dataX = -4:1:4;
dataY = [0 -1 -10 -40 -55 10 40 10 1];

figure(1)
plot(dataX, dataY, '*');

x = -2:0.01:2;
plot(-4:0.01:4, 1*conv(exp(-x).*heaviside(x),sin(x)), dataX, dataY, '*')

mdl = @(a, x)(a(1)*conv(exp(-x).*heaviside(x),sin(x)));

par=[1];
[fitted_par, r, J, cov, mse] = nlinfit(dataX, dataY, mdl, par);
What I am trying to do is to fit the function (a convolution) to the data set. However, I get an error due to vector size mismatch. I'm not sure what is going on here: The fitting routine should not care about how many data points I have?

Regards, Niels.
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Heat-related deaths in Manhattan projected to rise
>> Dire outlook despite global warming 'pause': study
>> Sea level influenced tropical climate during the last ice age
New Reply
Thread Tools


Similar Threads for: MATLAB: Fitting a convolution
Thread Forum Replies
Matlab function fitting Math & Science Software 2
[MATLAB] 3D Data Fitting Math & Science Software 6
curve fitting using matlab Engineering, Comp Sci, & Technology Homework 1
Curve fitting in Matlab Math & Science Software 1
curve fitting using Matlab Math & Science Software 0