Struggling to plot this graph
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi guys,
Im trying to plot 3 sets of data using this code with aswell as the 2 torques but i get a empty plot graph how would i fix this?
1 commentaire
Stephen23
le 10 Déc 2021
Modifié(e) : Stephen23
le 10 Déc 2021
Original question by Sebastian Sunny retrieved from Google Cache:
Struggling to plot this graph
Hi guys,
Im trying to plot 3 sets of data using this code with omegaRotor over windspeed aswell as the 2 torques but i get a empty plot graph how would i fix this?
%vairables defined
Cp = 0.335;
Ct = 0.042;
Vrated = 11.5; %m/s
Vcutin = 3; %m/s
Vcutout = 25; %m/s
D = 171;
k = 6e6;
j = 100e5;
%Create wind,time and rotational speed variables
WindSpeeds = linspace(0,30,30001);%m/s
deltaT = 0.01;
time = 0:deltaT:300;
%preallocation
rotorTorque = zeros(length(WindSpeeds),1); %Nm
turbinePower = zeros(length(WindSpeeds),1);
generatorTorque = zeros(length(WindSpeeds),1);
omegaRotor = zeros(length(WindSpeeds),1);
%eulers method
for i = 2:length(time)
omegaRotor(i) = omegaRotor(i-1) + deltaT*((windTurbineRotorModel(WindSpeeds(i),Ct,D,Vcutout,Vrated,Vcutin))-(k*omegaRotor(i-1).^2)/j);
generatorTorque(i) = k*(omegaRotor(i).^2);
rotorTorque(i) = windTurbineRotorModel(WindSpeeds(i),Ct,D,Vcutout,Vrated,Vcutin);
end
plot(WindSpeeds,omegaRotor(i))
plot(WindSpeeds,generatorTorque(i))
plot(Windspeeds,rotorTorque(i))
Réponse acceptée
Voss
le 5 Déc 2021
Remove the (i) indexing in your calls to plot. This will make plot create one line per call with all the time points rather than one line per data point with one point in each line.
Also, call hold on after the first call to plot so that subsequent calls to plot do not delete previous lines, which is the default behavior.
Also, in order to reproduce the plot in the image, you'll need to use plotyy or something similar to get multiple y-axes with different scales.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!