- When you say "5 data points", do you actually mean the 5 sets of data in your 5 plots?
- Do you want to fit a single curve that fits all 5 sets of data, or 5 curves (one for each set)?
- If you want 5 curves, are there any shared parameters?
- What kind of curve? Polynomial? What order polynomial?
- What's the relationship, if any, among the 5 sets of data?
Curve fit for data points
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Here is my code and im trying to curve fit the 5 data points and im having a hard time because they are all seperate!
figure(5)
plot(Fz_1100,Svy_1100)
scatter(Fz_1100,Svy_1100,'k');
hold on
plot(Fz_880,Svy_880)
scatter(Fz_880,Svy_880,'b');
hold on
plot(Fz_650,Svy_650)
scatter(Fz_650,Svy_650,'g');
hold on
plot(Fz_430,Svy_430)
scatter(Fz_430,Svy_430,'m');
hold on
plot(Fz_210,Svy_210)
scatter(Fz_210,Svy_210,'r');
hold on
4 commentaires
Réponses (1)
Cris LaPierre
le 13 Avr 2020
Here's how I would do it.
Fz = [Fz_1100 Fz_880 Fz_650 Fz_430 Fz_210];
Dy = [Dy_1100 Dy_880 Dy_650 Dy_430 Dy_210];
Cy = [Cy_1100 Cy_880 Cy_650 Cy_430 Cy_210];
By = [By_1100 By_880 By_650 By_430 By_210];
Ey = [Ey_1100 Ey_880 Ey_650 Ey_430 Ey_210];
Svy = [Svy_1100 Svy_880 Svy_650 Svy_430 Svy_210];
% Just show Svy
scatter(Fz,Svy,'k')
% fit Svy to a first order polynomial (y=m*x+b)
p=polyfit(Fz,Svy,1);
% Calculate Y values of fit line
fitY = polyval(p,Fz);
hold on
plot(Fz,fitY)
hold off
Voir également
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!