Filter löschen
Filter löschen

HELLO PLEASE HELP ME

1 Ansicht (letzte 30 Tage)
Arman
Arman am 13 Mai 2024
Kommentiert: Sam Chak am 14 Mai 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 Kommentare
John D'Errico
John D'Errico am 13 Mai 2024
Bearbeitet: John D'Errico am 13 Mai 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 am 13 Mai 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) = 

Melden Sie sich an, um zu kommentieren.

Antworten (1)

SOUMNATH PAUL
SOUMNATH PAUL am 13 Mai 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 Kommentare
SOUMNATH PAUL
SOUMNATH PAUL am 14 Mai 2024
Sam Chak
Sam Chak am 14 Mai 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu General Applications finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by