Clear Filters
Clear Filters

HELLO PLEASE HELP ME

1 view (last 30 days)
Arman
Arman on 13 May 2024
Commented: Sam Chak on 14 May 2024
I am from Armenia Master degree 1st course. I am very poor in Matlab. Please help me with my course work. my exercise is`
solve equation and then compare with simulink
equation is` y''''+y'''-y''-y'=2x+2sinx
y= c1+c2e^-x+c3x^e-x+c4^ex+2x-x^2-0.5(sin x +cos x)
  2 Comments
John D'Errico
John D'Errico on 13 May 2024
Edited: John D'Errico on 13 May 2024
I closed your other question, a duplicate of this one. But if you want to post here, you need to make an effort. You will learn nothing by just getting someone to do your work for you.
If you make an effort, then you can get help. But you need to be the one making an effort here.
Sam Chak
Sam Chak on 13 May 2024
Could you please share your lecture notes on the steps for solving this ordinary differential equation (ODE)? It is important to demonstrate the steps taught by your teacher in class when presenting the solution. Simply providing the answer without the accompanying steps would likely be considered meaningless by your teacher.
We can guide you to learn MATLAB.
ySol(x) = dsolve(eqn)
ySol(x) = 

Sign in to comment.

Answers (1)

SOUMNATH PAUL
SOUMNATH PAUL on 13 May 2024
Hi @Arman,
You will be needing Integrator blocks(4 integrator blocks) for derivative, function blocks(to implement the RHS of the equation) , sum blocks and a scope block for simulating the above equation in SIMULINK.
To compare the SIMULINK result with the analytical solution you can plot the analytical solution in MATLAB
% Define the analytical solution as a function
function y = analytical_solution(x, c1, c2, c3, c4)
y = c1 + c2*exp(-x) + c3*x.*exp(-x) + c4*exp(x) + 2*x - x.^2 - 0.5*(sin(x) + cos(x));
end
% Example parameters (assuming some constants since they're not given)
c1 = 1; c2 = 1; c3 = 1; c4 = 1;
% Define a range of x values
x = linspace(0, 10, 1000);
% Calculate the analytical solution
y = analytical_solution(x, c1, c2, c3, c4);
% Plot the analytical solution
figure;
plot(x, y);
title('Analytical Solution');
xlabel('x');
ylabel('y');
To compare the SIMULINK simulation results with the analytical solution, you would run the Simulink model over the same (x) range and then overlay the plots or directly compare the numerical results.
Hope it Helps!
Soumnath
  7 Comments
Sam Chak
Sam Chak on 14 May 2024
Your intention is genuinely good and kind, and I appreciate that. That's why I don't consider your approach a complete solution in the technical sense, as it doesn't directly fulfill OP's homework assignment. Nonetheless, your approach may serve as motivation for OP to write the code themselves. If OP chooses to share the code later on, we can review and provide corrections if needed. Your efforts in motivating and helping others are commendable!
It's important to acknowledge that some OPs prefer straightforward assistance, while others may feel uncomfortable sharing incomplete or poorly structured code that may contain errors. Unfortunately, there are instances where comments on platforms like Math StackExchange can be sarcastic or attack the OP's character or education for struggling with understanding math or coding.
However, in my experience, most OPs are willing to provide updates with their code when they feel motivated and receive guidance in the right direction. Providing examples from documentation or relevant links can greatly assist them in their learning process.

Sign in to comment.

Categories

Find more on General Applications in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!