Reverse modelling - function fitting to dataset

조회 수: 4 (최근 30일)
loes7815
loes7815 2016년 5월 11일
댓글: Star Strider 2016년 5월 11일
Hi!
I have a question, I would like to make a simulation model through reverse modelling. I have a data set to fit the simulation model. I tried to write a piece of code to practise, but I dont know how to make it work. What I want to do is making some kind of code (already got it) with for example three unknown parameters. These three parameters should be 'fit' within a range so that the mean squared error is as close to 0 as possible. I guess I need a function where after I try to find the combination of parameters which will result in mean squared error of around 0.
I don't need someone to do my homework, but I like to know were to start and what I need to google.
This is what I got so far:
function [m] = stat(a,b,c,d)
e = sin(a);
f = cos(b);
g = tan(c);
h = e*f;
i = g+e;
s = h-i;
m = sum(sqrt((s-d).^2));
end
and the code:
dataset = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21];
dataset = sin(dataset);
%plot(meetdata)
for p1 = 0 : 1 : 21
for p2 = 0.0 :0.1:2.0
for p3 = 0.01 :0.01: 0.4
[answer] = stat(p1,p2,p3,dataset);
disp(answer)
end
end
end
p1 = 0 : 1 : 21;
p2 = 0.0 :0.1:2.0;
p3 = 0.01 :0.01: 0.4;
fit = fminsearch(stat,0);
disp(fit)
Thank you!
  댓글 수: 1
Star Strider
Star Strider 2016년 5월 11일
You seem to want to do ‘system identification’. This takes input to and output data from a system and (usually assuming a linear time-invariant system), identifies a system that could produce the desired output from a given input. See the documentation for the System Identification Toolbox for details. If you have the Signal Processing Toolbox, consider using the invfreqz function.
Your desire to get ‘a mean squared error of around 0 is laudable but completely unrealistic in most real-world situations.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by