Struggling to plot this graph
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Stephen23
2021 年 12 月 10 日
編集済み: Stephen23
2021 年 12 月 10 日
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))
採用された回答
Voss
2021 年 12 月 5 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!