How to plot 2D line with a maximal value

2 visualizzazioni (ultimi 30 giorni)
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 Commenti
Susannah Duncan
Susannah Duncan il 12 Mag 2020
I have just attached the windpseed data. Thank you for your help!
Susannah Duncan
Susannah Duncan il 12 Mag 2020
I have replace P=0 with P(k)=0 but I get the same output on the graph.

Accedi per commentare.

Risposta accettata

Niharika Arora
Niharika Arora il 1 Giu 2020
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 Commenti
Walter Roberson
Walter Roberson il 1 Giu 2020
[VVs, VVidx] = sort(Vv);
plot(VVs, PP(VVIdx));
Susannah Duncan
Susannah Duncan il 4 Giu 2020
This makes a lot more sense, thank you so much for your time !

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Discrete Data Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by