The 4th order ode is
y'''' +5*y'''-2*i*y''-(1/A)*y'+(2-lambda)*y=0
b.c.: y(0)=y(1)=y'(0)=y'(1)=0.
In which A is a given real number, i is the imaginary unit (i^2= -1), lambda is the unknown eigenvalue.
I wrote the following code:
function mat4bvp
global A
A = 1;
lambda = -0.5+0.2*i;
solinit = bvpinit(linspace(0,1,1000),@guess,lambda);
sol = bvp4c(@stream,@bc,solinit);
x = linspace(0,1,1000);
y = deval(sol,x);
plot(x,y(1,:));
function v = guess (x)
v = [1-cos(2*pi*x)
2*pi*sin(2*pi*x)
(2*pi)^2*cos(2*pi*x)
-(2*pi)^3*sin(2*pi*x)];
function dxdy = stream(x,y,lambda)
global A
dxdy=[y(2)
y(3)
y(4)
-5*y(4)+2*i*y(3)+(1/A)*y(2)+(lambda-2)*y(1)];
function res = bc(ya,yb)
res=[ya(1)
ya(2)
yb(1)
yb(2)
ya(3)-1]; %%%The last condition is additionally imposed because lambda is to be solved for
After running it, it generated the following error:
Error using trial>bc
Too many input arguments.

댓글 수: 3

T S Singh
T S Singh 2017년 12월 27일
Harry Lee, I am also trying to solve a similar equation. Can you please clarify how the fifth boundary conditions is extracted from the four BCs or from the differential equation. My equation is for clamped-free equation of Euler cantilever beam and I am trying to solve like a eigen value problem.
Harry Lee
Harry Lee 2017년 12월 27일
Singh, Since any non-zero constant multiple of an eigenfunction is still an eigenfunction, hence eigenfunctions are not unique. The uniqueness would be ensured (so then numerical program may find it out for you definitely) once an extra higher-order information is specified, this is what that 5-th BC was for.
Sahaluddin Mirza
Sahaluddin Mirza 2019년 5월 24일
Hey T S Singh, I am facing same problem as yours. Can u pls share your code, if u solved it? I need help finding the first 5 modes of vibration and am stuck finding the 5th boundary condition.

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2017년 7월 1일

1 개 추천

You are using bvpinit() and passing in a vector of length 1 as the third parameter. That initializes "parameters" to a vector of length 1 in the problem structure, and you see that parameter showing up in the third position for your stream() function. However, when you have parameters, they are also passed to your bc function, but your bc function is not expecting anything for parameters.
function res = bc(ya, yb, lambda)
Whether you need it for the computation or not, it is going to be passed in.

댓글 수: 1

Harry Lee
Harry Lee 2017년 7월 1일
Thanks! I just have another quick question: does BVP4c allows one to specify the number of grid points to be used in the discretization?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

질문:

2017년 7월 1일

댓글:

2019년 5월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by