필터 지우기
필터 지우기

HELLO PLEASE HELP ME

조회 수: 1 (최근 30일)
Arman
Arman 2024년 5월 13일
댓글: Sam Chak 2024년 5월 14일
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
John D'Errico
John D'Errico 2024년 5월 13일
편집: John D'Errico 2024년 5월 13일
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 2024년 5월 13일
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) = 

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

답변 (1개)

SOUMNATH PAUL
SOUMNATH PAUL 2024년 5월 13일
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
SOUMNATH PAUL
SOUMNATH PAUL 2024년 5월 14일
Sam Chak
Sam Chak 2024년 5월 14일
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.

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

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by