Struggling to plot this graph
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sebastian Sunny
el 5 de Dic. de 2021
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 comentario
Stephen23
el 10 de Dic. de 2021
Editada: Stephen23
el 10 de Dic. de 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))
Respuesta aceptada
Voss
el 5 de Dic. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!