Using the Integral-function
1 view (last 30 days)
Show older comments
Hi, I have a problem using the function integral on Matlab R2018b.
The error is: Too many Input arguments.
function [t]=schwingungsdauerK6_A3(L,phi0)
g=9.81;
k=sin((phi0)./2);
koeff=4*sqrt(L./g);
fun=@(x) 1./(sqrt(1-(k.*(sin(x))).^2));
u=integral(fun,0,(2*pi));
t=koeff.*u
end
and I start it with this script.. for example
L=9.81
phi0 =30 degree
disp('Schwingungsdauer bei phi0= 30Grad');
erg=schwingungsdauerK6_A3(9.81,30);
fprintf('Schwingungsdauer beträgt %.2f sec',erg);
Can anyone tell my where my mistake is?
0 Comments
Answers (3)
madhan ravi
on 23 Nov 2018
Edited: madhan ravi
on 24 Nov 2018
Bitte ausprobieren:
L=9.81
phi0 =30 %degree
disp('Schwingungsdauer bei phi0= 30Grad');
erg=schwingungsdauerK6_A3(9.81,30); %function call
fprintf('Schwingungsdauer beträgt %.2f sec\n',erg);
function [t]=schwingungsdauerK6_A3(L,phi0) %function definition
g=9.81;
k=sind((phi0)./2);
koeff=4*sqrt(L./g);
fun=@(x) 1./(sqrt(1-(k.*(sin(x))).^2));
u=integral(fun,0,(2*pi));
t=koeff.*u
end
command window:
>> COMMUNITY
L =
9.8100
phi0 =
30
Schwingungsdauer bei phi0= 30Grad
t =
25.5703
Schwingungsdauer beträgt 25.57 sec
>>
8 Comments
madhan ravi
on 24 Nov 2018
C:\Program Files\MATLAB\R2018b\toolbox\matlab\funfun\integral.m % Shadowed
As the message clearly says that you have some file with the name of integral please remove it or rename because it's shadowing the in-built function integral
Matthias Radspieler
on 24 Nov 2018
Edited: Matthias Radspieler
on 24 Nov 2018
1 Comment
Star Strider
on 24 Nov 2018
This is the problem:
C:\Users\Matthias\Documents\MATLAB\integral.m
The solution is to rename your function to something that is meaningful to you and does not overshadow any built-in MATLAB functions.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!