the eq is x"+[h+k*cos(t)]x=0
the t on the priod [0,2pi]
and the intial conditions are x(0)=1 and x'(0)=0
i need the all x when the h&k changes from 0 to 100

댓글 수: 3

Steven Lord
Steven Lord 2020년 7월 17일
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
If this isn't a homework assignment, see the ode45 function.
format long
p = pi
a = .5;
b = .5;
syms y(t)
[V] = odeToVectorField(diff(y, 2) == -1*(a+b*cos(2*t))*y)
M = matlabFunction(V,'vars', {'t','Y'})
sol = ode45(M,[0 2*pi],[0 1]);
fplot(@(x)deval(sol,x,1),[0, 20])
i solve it for a certin number of h&k but i cant solve it for multibale numbers for h&k
thanks for the answer
madhan ravi
madhan ravi 2020년 7월 17일
And you will delete your question content in few minutes probably ;)

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

답변 (1개)

madhan ravi
madhan ravi 2020년 7월 17일

1 개 추천

댓글 수: 3

u rly got me but i think i much stupid than ur expictaions :(
still cant put these two together can u give me another hint
function y = findzero(a,b,x0)
y = fzero(@poly,x0);
a = .5
b= .5
function syms y(t)
[V] = odeToVectorField(diff(y, 2) == -1*(a+b*cos(2*t))*y)
M = matlabFunction(V,'vars', {'t','Y'})
end
end
Saladin Hossam
Saladin Hossam 2020년 7월 17일
thats like much much important for me in this pandamic my professor dont replay to my masseges so im hopeless i need to submit that in like 2 days
much much love for ur helping
im realy straggling here xD
function y = findzero(a,b,x0)
Y = diff(y,t)
a =[0 100]
b= [0 100]
function
[V] = odeToVectorField(diff(y, 2) == -1*(a+b*cos(2*t))*y)
M = matlabFunction(V,'vars', {'t','Y'})
sol = ode45(M,[0 2*pi],[0 1]);
end
end

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

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

질문:

2020년 7월 17일

댓글:

2020년 7월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by