Shooting Method: issues with zero

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 个评论

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)

请先登录,再进行评论。

回答(1 个)

Jyotsna Talluri
Jyotsna Talluri 2020-1-17

0 个投票

You have defined a function with function name hw7_24p16ydxn and you are calling a function 'hw7_24p16dydxn' which does not exist

类别

帮助中心File Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by