How to plot 2D line with a maximal value

조회 수: 2 (최근 30일)
Susannah Duncan
Susannah Duncan 2020년 5월 12일
댓글: Susannah Duncan 2020년 6월 4일
Hello,
I'm trying to plot the power output of of a 10 kW wind turbine with respect to per second wind speed data. I would like a singular line following the output but instead I have these vertical line for each value - how can I correct it?
I would also like a solid line for my power curve but only a scatter graph gives me the shape I'm after.
Thank you for your help!
%% Code for 10 KW Wind turbine of Diameter 7.1m, rho = 1.16 at hub height 30m, cut in speed 3 m/s,
V = xlsread('windspeed.xlsx','F2:F86401');%wind data per second in a day
Vv= V';
%G = xlsread('windspeed.xlsx','H2:H86401');%generation based on capacity factor of 0.42
for k=1:length(V)
if V(k) < 3 || V(k)>26
P=0;
else P(k) = min( 10000, 0.5*1.16*35*V(k)^3);%power in watts
end
end
Pp = P/1000;%into kW
Pp1 = Pp';
E= (sum (Pp))/3600 %into kWh, energy produce on that day by the turbine
Cp = (E/(10*60*60*24/3600))
t =1:length(V);
figure (1)
plot (Pp)
title ('Power output per second');
xlabel('time (s)');
ylabel('Power out(kW)');
xlim([0 86400])
ylim([0 12])
figure (2)
scatter (Vv,Pp)
title ('Power Curve')
xlabel('time (s)')
ylabel('Power out(kW)')
xlim([0 30])
ylim([0 12])
  댓글 수: 5
Susannah Duncan
Susannah Duncan 2020년 5월 12일
I have just attached the windpseed data. Thank you for your help!
Susannah Duncan
Susannah Duncan 2020년 5월 12일
I have replace P=0 with P(k)=0 but I get the same output on the graph.

댓글을 달려면 로그인하십시오.

채택된 답변

Niharika Arora
Niharika Arora 2020년 6월 1일
The reason for the non-linear plot line is following the values contained in the variable 'Pp'.
For example look at the following zoomed in part of the graph:
notice the values between (1200-1230):
The values fall from 10 to some different values and then back again to 10.
Thus, the graph you are getting is the correct graph.
However if you want to get a straight plot line anyway you could sort the values of Pp before providing it to the plot().
The new call to plot() would look as follows:
>> plot(sort(pp))
This would plot a single line as can be seen the graph above. However, the index association will not be there.
The reason for getting a smooth Power Curve while using scatter is that scatter does not connect the markers. Thus there is no index associativity.
As you can see in the above graph, you can use 'plot()' for the Power Curve with markers on and the markers will follow the same trajectory as in the scatter plot.
The only difference is the line joining, which happens in 'plot()' but not in 'scatter()'.
Again you can sort the data to get a smooth curve.
>> plot(sort(Vv),sort(Pp))
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 6월 1일
[VVs, VVidx] = sort(Vv);
plot(VVs, PP(VVIdx));
Susannah Duncan
Susannah Duncan 2020년 6월 4일
This makes a lot more sense, thank you so much for your time !

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by