HELLO PLEASE HELP ME

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

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

John D'Errico
John D'Errico on 13 May 2024
Edited: John D'Errico on 13 May 2024
Please don't do student homework assignments. This does not help the student. It teaches them only to keep on posting, expecting there will always be a sucker willing to do their work for them.
It actively hurts the forum, as it also teaches other students to do the same, expecting someone to step forward and do their homework too, with no effort made or shown.
Arman
Arman on 13 May 2024
@John D'Errico BRO THIS IS NOT MINE PRIMARY PROFESSION THIS IS SECONDARY I AM ELECTRYCAL ENGENEER. SO THATS WHY I NEED YOUR HELP. MY PROFFESIONAL HOMEWORKS I DO MYSELF
I don't view @SOUMNATH PAUL's approach as a complete solution since the Simulink model won't function without the initial values. Your teacher had already provided the symbolic analytical answer for comparison purposes.
Additionally, Wolfram Alpha can also display the solution similar to MATLAB. Could you please clarify if your teacher specifically requires the code or she just wants to see the final answer? If so, please share it with us.
John D'Errico
John D'Errico on 13 May 2024
Edited: John D'Errico on 13 May 2024
@Arman - You posted a homework question, with no effort made. What you are is irrelevant. I was a mechanical engineer at one point in time. And so what?
You need to do your own homework. This is a course you chose to take, and you claim to be working towards a masters degree. Any student, in ANY course needs to do the work for that course. So start making an effort.
Hi @Sam Chak, I acknowledge that this is not the complete solution but the goal here was to give a direction for the assignment not solve the entire problem.
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

Asked:

on 13 May 2024

Commented:

on 14 May 2024

Community Treasure Hunt

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

Start Hunting!