Error: Function definition not supported in this context. Create functions in code file.
Show older comments
I have a problem with launching a function I created. Can anybody help me what's wrong with this line?
error: Error: File: MetData3.m Line: 10 Column: 5
Function definition not supported in this context. Create functions in code file.
Code:
classdef MetData3
properties
WindSpeed
end
properties (Access=protected)
Gamma = 1.7934;
Beta = 4.1007;
end
function WeibData = WeibFormWind(theMetData)
try
WeibData=zeros(1,max(theMetData.WindSpeed));
for j=1:1:max(size(WeibData))
i=1;
for k=1:1:max(size(theMetData.WindSpeed))
if theMetData.WindSpeed(k)==j
WeibData(j)=WeibData(j)+theMetData.WindSpeed(k);
i=i+1;
end
end
end
WeibData=WeibData/sum(theMetData.WindSpeed);
bar(WeibData);
catch
disp('Problem')
end
end
function monthYield = monthWeibull(theMetData)
close all
montrYield = zeros(1,max(size(theMetData.monthAvrWS)));
for k=1:1:max(size(theMetData.monthAvrWS))
B = theMetData.Beta * theMetData.monthAvrWS(k);
v = 0:0.1:20;
Weib1 = @(u) (theMetData.Gamma/B).*(u*(1/B)).*exp(-(u*(1/B)).^2);
Weib2 = @(u) ((theMetData.Gamma/B).*(u*(1/B)).*exp(-(u*(1/B)).^2).sin((pi/2)*((u-theMetData.Vd)/(theMetData.Vo-theMetData.Vd))));
t1=integral(Weib1, theMetData.Vo, theMetData.Vg);
E1=(theMetData.Gamma/B)*theMetData.Nn*t1;
t2=integral(Weib2, theMetData.Vd, theMetData.Vo);
E2=(theMetData.Gamma/B)*theMetData.Nn*t2;
monthYield(k)=E1+E2;
curve=Weib1(v);
plot(v,curve);grid on,hold on;
xlabel('prędkość wiatru');ylabel('t/T');
end
hold off;
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Function Handles 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!