Solving matrix of equations
3 views (last 30 days)
Show older comments
Hi
Can someone help me with following problem: I got this matrix with 5 equations where a1,a2,a3,a4,a5 and b1,b2,b3,b4,b5 are known numbers (for example a1=1,a2=1.5,a3=1.3,a4=1.7,a5=0.8 and b1=2,b2=4,b3=3,b4=5,b5=2.5)
a1=C1*(b1 )^(C2 )
a2=C1*(b2 )^(C2 )
a3=C1*(b3 )^(C2 )
a4=C1*(b4 )^(C2 )
a5=C1*(b5 )^(C2 )
I need to find the best fitting numbers for C1 and C2. Is there some function in matlab I can use?
thanks in advance!
0 Comments
Accepted Answer
Andrei Bobrov
on 14 Dec 2011
use function nlinfit from Statistics Toolbox
a =[1 1.5 1.3 1.7 0.8]
b =[2 4 3 5 2.5]
fout = @(c,x)c(1)*x.^c(2)
c2 = nlinfit(b,a,fout,[1 1])
fout(c2,b)
ans =
0.88459 1.4641 1.1878 1.722 1.0404
[b1,i1] = sort(b);
a1 = a(i1);
x = linspace(b1(1),b1(end),20);
plot(b1,a1,'ro',x,fout(c2,x));grid on
3 Comments
More Answers (1)
Aldin
on 15 Dec 2011
I can solve your problem. Numerical mathematic If you are familiar with approximation newton's method you can solve it. See this: <http://www.google.com/imgres?q=Numerical+mathematical+approximations&um=1&hl=en&sa=N&biw=1280&bih=709&tbm=isch&tbnid=5WBPaYfADVwhlM:&imgrefurl=http://dmpeli.mcmaster.ca/Matlab/Math1J03/LectureNotes/Lecture3_2.htm&docid=sr12MXThpioXRM&imgurl=http://dmpeli.mcmaster.ca/Matlab/Math1J03/LectureNotes/Lecture3_2_files/image004.jpg&w=456&h=342&ei=ojrqTo66DcKL4gTo2pzoCA&zoom=1&iact=hc&vpx=870&vpy=353&dur=814&hovh=157&hovw=208&tx=102&ty=74&sig=102940788651406343855&page=6&tbnh=157&tbnw=208&start=93&ndsp=17&ved=1t:429,r:9,s:93>
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!