interpolation to maximum points

1 Ansicht (letzte 30 Tage)
Alzapoa
Alzapoa am 24 Aug. 2012
Hi all, I have below code to generate a group of graphs. I need to interpolate a line through their maximum points. could you please help? in addition I need to cut the graph below the -0.1 if it is possible. Thanks
Cp=[ ];
landa=(0:0.1:16);
for B=0:3:30
for i=1:1:length(landa)
landa_i=1/((1/(landa(i)+0.08*B))-(0.035/(B^3+1)));
Cpi=0.22*((116/landa_i)-(0.4*B)-5)*exp(-12.5/landa_i);
Cp=[Cp Cpi];
end
if B==0
Cpmax=max(Cp);
end
plot(landa,Cp,'b');
% mesh(landa,B);
hold on;
Cp=[ ];
end
xlabel('Tip speed ratio');
ylabel ('Performance corfficient Cp');
hold off;

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 24 Aug. 2012
close
Cp=[ ];
landa=(0:0.1:16);
result=[];
for B=0:3:30
for i=1:1:length(landa)
landa_i=1/((1/(landa(i)+0.08*B))-(0.035/(B^3+1)));
Cpi=0.22*((116/landa_i)-(0.4*B)-5)*exp(-12.5/landa_i);
Cp=[Cp Cpi];
end
if B==0
Cpmax=max(Cp);
end
result=[result Cp'];
plot(landa,Cp,'b');
% mesh(landa,B);
hold on;
Cp=[ ];
end
xlabel('Tip speed ratio');
ylabel ('Performance corfficient Cp');
%hold off;
[i1,j1]=max(result)
xi=landa(j1);yi=i1;
xyi=sortrows([xi' yi'],1)
hold on
x1=landa(min(j1):max(j1))
y1=interp1(xyi(:,1),xyi(:,2),x1);
plot(x1,y1,'r')
set(gca,'ylim',[-0.1 max(i1)])
  2 Kommentare
Alzapoa
Alzapoa am 24 Aug. 2012
Hi Azzi, Thanks for the solution. if you look at the result plot the red line goes to landa=0.4382 and then back down which is not meant to do that. it should go through the max values independent from the order of plot. so what to do with that I hope I am clear.
Azzi Abdelmalek
Azzi Abdelmalek am 24 Aug. 2012
but i ve used your result. what kind of interpolation do you want?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by