Curve fitting??
1 view (last 30 days)
Show older comments
I have 3 curves which are related to 2 variables. One dependent and another independent. I want relationship between these variables for all the three curves. Is this possible with curve fitting? I'm not sure. If yes could you please suggest an article closely related the above problem? I'm overwhelmed seeing the contents for curve fitting in general. If not curve fitting what else can help me in this matter? I also have a table with all the values. Can i use that instead of curves to form formula between variables?
0 Comments
Answers (1)
bym
on 9 Sep 2011
perhaps I am misunderstanding, but the following shows how to fit 3 curves in two variables:
clc;clear;close all
x = sort(rand(20,1)); % independent variable
X = [ones(20,1),x,x.^2]; % Vandermonde matrix
y = X*[1 2 3;2 2 3;3 3 5 ]; % dependant variable; arbitrary coefficients
y = y+rand(20,3)*.5; % add noise
coeff = X\y; % get coefficients
yhat = X*coeff; % get predictions
plot(x,yhat);hold on;
plot(x,y,'.') %plot
HTH
0 Comments
See Also
Categories
Find more on Interpolation 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!