Clear Filters
Clear Filters

Try to make a function for deflection and is just dosen`t want to work.

4 views (last 30 days)
Hello here is the task what I need to do. I been only able to do some part of it and not really knw why is my code not want to work. Tried use the help, but still cant figure it out what is the problem.
The maximum deflexion of a wind turbine blade should be no more than 10% of its span. The formula used to calculate deflexion being: Delta = (W*L.^3)/(8*E*I)
Where D is the deflexion in mm and L is the length of the blade, mm. Given that the maximum load (W) to be applied to the blade is 8500N, E the elastic modulus of the blade material is 42000 N/mm2, I is 10 million mm4. Create a MATLAB function to determine whether the deflexion of the blade will exceed design parameters or not. Your function should require Length as an input and return the resulting deflection as an output
As a secondary output, the function should also display one of two lines ’Maximum deflexion is tolerable ’ or ’Maximum deflexion will be exceeded’ depending on the value of delta. Demonstrate your code working for the following lengths;
1. 4.2m
2. 10m
3. 25m
Calculate the MAXIMUM tolerable blade length (hint: calculate L when ∆/L = 0.1)
My Code:
function deflection = Wind_turbinDef()
L= input('Lenght of the wind turbine blade in meter: ')*u.m; %Use this input to we can measure the blead deflexion in any lenght.
L=unitConvert(L,u.mm); %The lenght mast be in mm to be able to use in the formular so needed to comvert it.
W=8500*u.N; %The walue is the maximu constant
E=42000 *u.N/u.mm^2; %Elastic modulus of the blade
I=10*(10^6)*u.mm^4;
Delta=vpa((W*L^3)/(8*E*I));% Used vpa() to simplify the last division on the deflexion formular
%max deflexion is 10% from it span
Lim=L*0.1;
deflection = Delta-Lim;
if deflection < 0
Deflection= "Maximum deflexion is tolerable!";
elseif deflection == 0
Deflection = "Maximum deflexion is tolerable!";
else deflection > 0
Deflection = "Maximum deflexion will be exceeded!";
end
end
Thank you for any help!
  4 Comments
Walter Roberson
Walter Roberson on 31 Dec 2018
Your code does not display the required messages .
Your function should take the length as a parameter instead of using input()
Your code does not define u for u.mm
why are you expecting the length in metres when all of the sample inputs are mm ?
Milan Sumegi
Milan Sumegi on 31 Dec 2018
Walter sorry wrote it wrong, changed it now. Cos some of the date in meter so I need to changed them to mm to get it work. Am I right?
Ok I try to change thanks

Sign in to comment.

Accepted Answer

Stephen23
Stephen23 on 31 Dec 2018
Edited: Stephen23 on 31 Dec 2018
Simpler:
>> W = 8500; % max load (N)
>> E = 42000; % elastic modulus (N/mm^2)
>> I = 10e6; % ??? (mm^4)
>> Dfun = @(L) (W*L.^3)/(8*E*I); % blade length (mm)
>> D = Dfun([4.2,2.10,3.25]*1000)
D =
187.425 23.428 86.842
>> Lmax = fzero(@(L)Dfun(L)/L-0.1,[1,1e6])
Lmax = 6287.2
And this is easy to check by plotting:
>> Lv = 1:1e4;
>> Rv = Dfun(Lv)./Lv;
>> plot(Lv,Rv)
>> hold on
>> plot(Lmax,0.1,'*r')
>> xlabel('blade length (mm)')
>> ylabel('ratio D/L')
untitled.png
  4 Comments
Stephen23
Stephen23 on 31 Dec 2018
Edited: Stephen23 on 31 Dec 2018
@Milan Sumegi: use if or indexing:
>> Lw = [4.2,2.10,3.25,7]*1000
Lw =
4200 2100 3250 7000
>> Dw = Dfun(Lw)
Dw =
187.425 23.428 86.842 867.708
>> Rw = Dw./Lw
Rw =
0.044625 0.011156 0.026721 0.123958
>> C = {'is tolerable','will be exceeded'};
>> D = [num2cell(Lw);C(1+(Rw>0.1))];
>> fprintf('Length %d maximum deflection %s\n',D{:})
Length 4200 maximum deflection is tolerable
Length 2100 maximum deflection is tolerable
Length 3250 maximum deflection is tolerable
Length 7000 maximum deflection will be exceeded

Sign in to comment.

More Answers (1)

Milan Sumegi
Milan Sumegi on 31 Dec 2018
Tried make it differently but had not a clue how to change it to work.
u=symunit;
format short g
L= input('Lenght of the wind turbine blade in meter: ')*u.m;
L=unitConvert(L,u.mm);
W=8500*u.N;
E=42000 *u.N/u.mm^2;
I=10*(10^6)*u.mm^4;
format long g
Delta=vpa((W*L1^3)/(8*E*I))
Tol=0.1;
function [MaxDefl] = mycal()
MaxDefl=vpa(L*Tol);
if MaxDefl>Delta
disp("Maximum deflexion is tolerable!")
elseif MaxDefl==Delta
disp("Maximum deflexion is tolerable!")
else MaxDefl<Delta
disp("Maximum deflexion will be exceeded!")
end
end
Here is another script,

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!