Graphs not matching, please help
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to make a graph with a function.
This is my graph ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/829195/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/829195/image.png)
I need it to look like this graph ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/829200/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/829200/image.png)
Here is my function
function [turbinePower] = windTurbineModel(windSpeed,deltaT,cD,k)
%variables
cTau = 0.042;
vRated = 11.5;
vCutin = 3;
vCutout = 25;
D = 171;
J = 100e5;
time = 0:deltaT:300;
%wind and rotational variables
rotationalSpeeds = zeros(length(windSpeed),1);
rotorTorque = zeros(length(windSpeed),1);
generatorTorque = zeros(length(windSpeed),1);
turbinePower = zeros(length(windSpeed),1);
rotorAcc = zeros(length(windSpeed),1);
for i = 2:length(time)
rotorTorque(i) = windTurbineRotorModel(windSpeed(i),cTau,D,vCutin,vCutout,vRated);
generatorTorque(i) = k*((rotationalSpeeds(i-1))^2);
rotorAcc(i) = (rotorTorque(i)-generatorTorque(i)-cD*rotationalSpeeds(i))/J;
rotationalSpeeds(i) = rotationalSpeeds(i-1) + deltaT*(rotorAcc(i))./J;
turbinePower(i) = generatorTorque(i)*rotationalSpeeds(i);
end
end
and here is my graph code
close all
clear
%variables
k=6*10.^(1:1:10);
Cd = 1.5*10.^(1:1:8);
deltaT = 0.01;
time = 0:deltaT:300;
turbinePowerMean = zeros(length(Cd),length(k));
turbinePowerStd = zeros(length(Cd),length(k));
%------------------Do not edit these lines---------------------------------
windTimeSeries = wblrnd(13,2.10,size(time'));
windTimeSeries = medfilt1(windTimeSeries,50,'truncate');
%-------------------------------------------------------------------------
for i = 1:length(k)
for ii = 1:length(Cd)
turbinePower = (windTurbineModel(windTimeSeries,deltaT,Cd(ii),k(i)));
turbinePowerMean(ii,i) = mean(turbinePower);
turbinePowerStd(ii,i) = std(turbinePower);
end
end
subplot(1,3,1);
h1 = heatmap(k,Cd,turbinePowerMean/7e6);
title("Mean Power Output for varying k and C_d");
ylabel("Damping coeff kg m^3 s^-^1");
xlabel("Generator control Gain, k");
subplot(1,3,2);
heatmap(k,Cd,turbinePowerStd/7e6);
subplot(1,3,3);
heatmap(k,Cd,turbinePowerMean./turbinePowerStd);
0 Kommentare
Antworten (1)
M.B
am 10 Dez. 2021
Not sure I understand what you need.
To make your figure as close as the target, you can try to:
- add titles and axis labels for subplots 2 and 3
- set the background of the figure to white [set(gcf, 'color', 'white');]
- resize the figure vertically
If you are talking about the colour of the boxes, then you need to verify your data and make sure they are the same for both figures.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!