interpolation to maximum points
조회 수: 4 (최근 30일)
이전 댓글 표시
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;
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2012년 8월 24일
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
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!