Shooting Method: issues with zero

조회 수: 1 (최근 30일)
Laura Bell
Laura Bell 2020년 1월 13일
답변: Jyotsna Talluri 2020년 1월 17일
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
darova
darova 2020년 1월 13일
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일
You have defined a function with function name hw7_24p16ydxn and you are calling a function 'hw7_24p16dydxn' which does not exist

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by