Borrar filtros
Borrar filtros

how to express a formula for modelFun fo nlinfit

2 visualizaciones (últimos 30 días)
Donatas
Donatas el 3 de Abr. de 2014
Editada: Star Strider el 3 de Abr. de 2014
Hello, guys,
I have the formula (convolution):
where
and C is a matrix 1x40 and t is also a matrix of 1x40.
I want to use the first formula for non-linear least square fit (nlinfit), but I don't know how to write modelFun to express this formula, where MTT is a parameter, which I need to estimate.
Thanks for a reply!
Donatas

Respuesta aceptada

Star Strider
Star Strider el 3 de Abr. de 2014
Editada: Star Strider el 3 de Abr. de 2014
I made several guesses as to what you are doing, but this seems to work:
% Create data:
t = linspace(0, 1, 40);
C = t;
% y = conv(t,exp(-t),'same');
y = conv(exp(-t/7),t);
% Objective function for curve fit
% w = @(P,t) conv(C, exp(-t/P),'same');
w = @(P,t) conv(C, exp(-t/P));
xv = 0:length(y)-1;
B = nlinfit(t, y, w, 1)
yp = w(B,t);
figure(1)
plot(xv, y, 'xb')
hold on
plot(xv, w(B,t), '-r')
hold off
grid
Note that there are 'full', 'same' and 'valid' options with the conv function. Use the one that most closely suits your needs.

Más respuestas (0)

Categorías

Más información sobre Interpolation 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