I need MATLAB code that plots the aerodynamic power generated by a wind turbine vs the generator rotation speed for different wind speeds
2 views (last 30 days)
Show older comments
I need a new MATLAB code or patch for the following code that draws the aerodynamic power generated by the wind turbine versus the generator's rotation speed for different wind speeds:
clear; clc; close all;
% Define constants
rho = 1.225; % Air density [kg/m^3]
R = 35.25; % Radius of wind turbine [m]
% Define wind speeds
wind_speeds = [5 10 15 20]; % Wind speeds [m/s]
% Define generator rotation speeds
rotation_speeds = 0:1000:2000; % Rotation speeds [rpm]
% Calculate aerodynamic power for each wind speed and rotation speed
power = zeros(length(rotation_speeds), length(wind_speeds));
for i = 1:length(wind_speeds)
for j = 1:length(rotation_speeds)
wind_speed = wind_speeds(i);
rotation_speed = rotation_speeds(j) * (2*pi/60); % Convert rpm to rad/s
% Calculate aerodynamic power
power(j, i) = 0.5 * rho * pi * R^2 * (wind_speed^3) * rotation_speed;
end
end
% Plot the aerodynamic power
figure;
hold on;
colors = {'b', 'g', 'r', 'm'};
for i = 1:length(wind_speeds)
plot(rotation_speeds, power(:, i), colors{i});
end
hold off;
% Set plot properties
title('Aerodynamic Power vs. Generator Rotation Speed');
xlabel('Generator Rotation Speed [rpm]');
ylabel('Aerodynamic Power [W]');
legend(cellstr(num2str(wind_speeds', 'Wind Speed = %d m/s')));
% Adjust plot limits, if needed
% xlim([0 max(rotation_speeds)]);
% ylim([0 max(power(:))]);
% Save the plot as an image, if desired
% saveas(gcf, 'aerodynamic_power_plot.png');
4 Comments
Alan Stevens
on 6 Jul 2023
Your expression for power is linearly proportional to rotation speed, so you are only ever going to get straight line outputs from it!
Answers (2)
Image Analyst
on 6 Jul 2023
Looks like you're not plotting out far enough on the x axis to see the parabolic shape. You're only going out on the relatively flat upward sloping side of the parabola. Try increasing the range of the rotation speeds so that you can see the full parabola shape.
4 Comments
David Goodmanson
on 7 Jul 2023
Edited: David Goodmanson
on 7 Jul 2023
His code is well annotated and is an obvious straight line.
Image Analyst
on 7 Jul 2023
Yes we know he's getting straight lines but what he wants is curvy lines like
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428963/image.png)
so that's why I suggested he may have the wrong equation. It looks like Sam did some research and perhaps has found the proper equation to use.
Sam Chak
on 6 Jul 2023
Hi @itouchene
You can clearly identify the relationship here:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428448/image.png)
If the aerodynamic power is y, the rotation speed is x, and this term
is a constant, then mathematically, you are plotting
, which is a straigh line.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428453/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428458/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428463/image.png)
where the coefficient of power,
is a nonlinear function of lambda (λ), given by
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428468/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428473/image.png)
with ω is the tip rotational speed.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428478/image.jpeg)
0 Comments
See Also
Categories
Find more on Wind Power in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!