필터 지우기
필터 지우기

how to express a formula for modelFun fo nlinfit

조회 수: 2 (최근 30일)
Donatas
Donatas 2014년 4월 3일
편집: Star Strider 2014년 4월 3일
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

채택된 답변

Star Strider
Star Strider 2014년 4월 3일
편집: Star Strider 2014년 4월 3일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by