Plotting graphs with best fit lines
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, I'm attempting to plot a "Pressure Change as a function of Voltage" with given data points. The plot should have the points, a best fit line and two lines of uncertainty on either side of the 'best fit line'. Currently my uncertainty lines are FAR below. Request assistance.
(My understanding of my jacked up legend is that there is something with my current driver and my 2020b Matlab, I'm not too worrried about that)
V=[1.000 2.000 2.500 3.000 3.500 4.000]'; %Voltage (V) with 0.05 accuracy
P=[626 948 1452 1727 1798 2001]'; %Pressure drop (Pa) +/-20
eV=0.05*ones(size(V));
eP=20*ones(size(P));
wVal=1./(eP/mean(eP));
errorbar(V, P, eP, eP, eV, eV, 'kx');
[fobj, gof]=fit(V,P,'poly1', 'Weights', wVal);
hold on
plot(fobj)
plot(range, PInt, 'b')
legend('data', 'cal curve', 'PI', 'Location', 'Northwest', 'Linewidth', 1)
title('Pressure Drop as funciton of Voltage')
xlabel('Voltage (V)')
ylabel('Pressure Change (Pa)')
axis square
box on
set(gcf, 'Color', 'w')
3 Commenti
dpb
il 15 Gen 2021
plot(range, PInt, 'b')
range and PInt are undefined above. Clearly, they must have been from some other dataset than that in V,P
Risposte (0)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
