calculating the slope of a curve on a plot

8 views (last 30 days)
Joseph
Joseph on 7 May 2016
Commented: dpb on 8 May 2016
I'm trying to calculate the slope of only one curve on a plot with many curves, then i want to calculate the percent error of that curve vs another curve. i have attached a picture. i want to calculate the slope of the red curve,'C_lift' and find the percent error between the red curve and the black curve,'C_lift,exp'. the code is below
% Basic plot of lift coefficient vs. angle of attack
figure(2)
hold on
plot(alpha_deg,clift,'r')
xlabel('Alpha (deg)')
figure(2)
hold on
plot(alpha_deg,cdrag,'g')
figure(2)
hold on
plot(alpha_deg,cmqc,'b')
figure(2)
hold on
plot(alpha_deg,xcp,'m')
figure(2)
hold on
plot(a_exp,cl_exp,'k')
title('NACA 0012 - C_{drag},C_{lift},C_{m,1/4},X_{CP},C_{lift,exp} vs Alpha')
ylabel('C_{lift},C_{drag},C_{m,1/4},X_{cp},C_{lift,exp}')
legend('C_{lift}','C_{drag}','C_{m/1/4}','X_{cp}','C_{lift,exp}')
  1 Comment
dpb
dpb on 8 May 2016
For what definition of "slope" and "error"? An average over the full set of data or pointwise, or what??? It appears the experimental data isn't terribly linear while the reference closer, but not perfect.

Sign in to comment.

Answers (0)

Categories

Find more on Line Plots 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!