making a residual graph with a function as a base line
Mostra commenti meno recenti
Hi,
I have a project i'd like to make a rusidual graph for but I'd like it to be between my data and the matlab curve fit for the data to show how close they are to one another. This is my code for the plot of the curve and my data, I tried to add a stem command to add the residual but is seems the base line must be a scalar. is there a way I can change the base line to a function?
I's like the graph to look something like this picture https://upload.wikimedia.org/wikipedia/commons/1/17/MDKQ1.svg
my code is added to this post right here:
H=[2.5;3.7;4.5;5.3;6.5;7.5;8.5;10.5;12.5;14.5;17.5;20.5;23.5;26.5];
g=[8.38;10.08;11.34;12.183;14.1;13.46;14.5;16.55;18.06;19.08;21.617;23.253;25.414;26.988];
m=[8.067;9.983;10.66;11.983;13.02;13.52;14.35;15.74;17.6;18.7;20.983;22.383;25.014;25.957];
errg=[0.194,0.643,0.413,0.452,0.503,0.162,0.438,0.544,0.258,0.293,0.385,0.354,0.353,0.372];
errm=[0.512,0.291,0.12,0.376,0.16,0.402,0.112,0.338,0.297,0.447,0.241,0.186,0.641,0.424];
f=fit(H,g,'power1');
plot(f,H,g,'-o')
hold on
stem(H,(g-f(H)),'BaseValue',-y_shift)
hold off
set(gca,'Fontsize',12)
title('מרחק פגיעה כדור זכוכית כתלות בגובה המגלשה')
xlabel('גובה H')
ylabel('מרחק פגיעה')
legend('גרף התאמה','נתוני מדידות')
axis([0,max(H)+1,0,max(g)+1])
grid on
thank you so much!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
