Shooting Method: issues with zero

3 Ansichten (letzte 30 Tage)
Laura Bell
Laura Bell am 13 Jan. 2020
Beantwortet: Jyotsna Talluri am 17 Jan. 2020
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 Kommentar
darova
darova am 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)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jyotsna Talluri
Jyotsna Talluri am 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

Kategorien

Mehr zu Dates and Time finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by