Not sure whats wrong with the values in this plot
古いコメントを表示
Hi guys, ive been stuck on this bit of code for awhile as im getting a empty plots, im not sure of what im doing wrong is to do with the actaul variables being wrong or is i ahve used the for loop vairale wrong.
7 件のコメント
Mathieu NOE
2021 年 12 月 9 日
hi
missing function windTurbineRotorModel
Walter Roberson
2021 年 12 月 9 日
plot(WindSpeeds,generatorTorque(i))
You are after the for i loop at that point, so i will have the scalar value that it was last assigned, which is length(time) . So you are asking to plot() with a vector on the x and a scalar for the y.
Sebastian Sunny
2021 年 12 月 9 日
Sebastian Sunny
2021 年 12 月 9 日
Walter Roberson
2021 年 12 月 9 日
if (WindSpeeds < Vcutin)
Is WindSpeeds a scalar or a vector? If it is a scalar, then that statement is okay. If it is a vector then the statement is questionable.
elseif all(WindSpeeds >Vcutin) && all(WindSpeeds <Vrated)
all those all() -- is WindSpeeds a vector or a scalar? If it is a scalar then if Vcutin is a vector then you have problems back in the if . If it is a scalar and Vcutin is a scalar then why confuse the reader by using all() ?
Be consistent in how you treat your inputs.
Sebastian Sunny
2021 年 12 月 9 日
Original question by Sebastion Sunny retrieved from Google Cache:
Not sure whats wrong with the values in this plot
Hi guys, ive been stuck on this bit of code for awhile as im getting a empty plots, im not sure of what im doing wrong is to do with the actaul variables being wrong or is i ahve used the for loop vairale wrong. I' ve attached a picture of what the graph should look like and the result im getting.

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
yyaxis left
plot(WindSpeeds,omegaRotor)
hold on
plot yy
yyaxis right
plot(WindSpeeds,generatorTorque(i))
hold on
yyaxis right
plot(WindSpeeds,rotorTorque)

採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Axes Transformations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
