Shooting Method: issues with zero
1 view (last 30 days)
Show older comments
I am struggling with Problem 24.16 (see attatched). This is the code I have been using, but I keep getting the following error:
Error using fzero (line 306)
FZERO cannot continue because user-suppliedfunction_handle ==> hw7_24p16res failed with theerror below.
Undefined function 'hw7_24p16dydxn' for input arguments of type 'double'.
Error in hw7_24p16 (line 55)
[x,y]=ode45(@hw7_24p16dydxn,tspan,[5 fzero(@hw7_24p16res,L)]);
Here is my code:
clear all
close all
E=200*10^9;%in Pa
I=30000*10^(-8);%m^4
w=15*10^3;%N/m
L=3;%m
x=[0 L];
y=[0 0];
fprintf('(b) the shooting method\n')
fprintf('\n')
tspan=x;
[x,y]=ode45(@hw7_24p16dydxn,tspan,[5 fzero(@hw7_24p16res,L)]);
plot(x,y(:,1))
Functions:
function [dy]=hw7_24p16ydxn(x,y)
E=200*10^9;%in Pa
I=30000*10^(-8);%m^4
w=15*10^3;%N/m
L=3;%m
%x=[0 L];
%y=[0 0];
dy=[y(2);
(w*L*x-w*x^2)/(2*E*I)];
end
function [r]=hw7_24p16res(za)
[x,y]=ode45(@hw7_24p16dydxn,[0 L],[0 za]);
r=y(end,1)-0;
HELP!
1 Comment
darova
on 13 Jan 2020
It means that function with this name doesn't exist
Undefined function 'hw7_24p16dydxn' for input arguments of type 'double'.
Look
function [dy]=hw7_24p16ydxn(x,y)
Answers (1)
Jyotsna Talluri
on 17 Jan 2020
You have defined a function with function name hw7_24p16ydxn and you are calling a function 'hw7_24p16dydxn' which does not exist
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations 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!