Clear Filters
Clear Filters

interpolation to maximum points

4 views (last 30 days)
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;

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 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 Comments
Alzapoa
Alzapoa on 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 on 24 Aug 2012
but i ve used your result. what kind of interpolation do you want?

Sign in to comment.

More Answers (0)

Categories

Find more on Wind Power in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!