pls i need help fast

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 Comments

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
And you will delete your question content in few minutes probably ;)

Sign in to comment.

Answers (1)

madhan ravi
madhan ravi on 17 Jul 2020

1 vote

3 Comments

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
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

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Asked:

on 17 Jul 2020

Commented:

on 17 Jul 2020

Community Treasure Hunt

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

Start Hunting!