# I need MATLAB code that plots the aerodynamic power generated by a wind turbine vs the generator rotation speed for different wind speeds

12 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

### Answers (2)

Image Analyst
on 6 Jul 2023

##### 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

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:

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.

where the coefficient of power, is a nonlinear function of lambda (λ), given by

with ω is the tip rotational speed.

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!