Métodos numéricos en simulink

조회 수: 9 (최근 30일)
Valeria
Valeria 2024년 8월 24일
답변: Malay Agarwal 2024년 8월 28일
Tengo una tarea de resolver analíticamente una ecuación diferencial por el método de Euler (lo hice con maltab) con su gráfica, y luego hacer diagrama de bloques en simulink para ver la gráfica nuevamente con un scope. Soy completamente nueva en simulink y el profesor no lo explicó por lo que quería ver si alguien puede ayudarme
El código de matlab es el archivo "Euler_analitico01.mlx"
Me da la gráfica:
y el scope de simulink me sale:

답변 (1개)

Malay Agarwal
Malay Agarwal 2024년 8월 28일
I'm not sure if your professor wants you to use the Euler's method in Simulink as well. You can solve differential equations in Simulink by using "Integrator" blocks and other blocks to model the complete equation.
In your case, since this is a second-order differential equation, you will need two "Integrator" blocks:
  • The first one will take in as input the signal "y''", which is the second-order derivative. It will output the first-order derivative "y'".
  • The second one will take this first-order derivative as input and output the signal "y".
This is shown below:
You then need to make appropriate connections to first model the right-hand side of the equation. Since the right-hand side has the square of the first-order derivative, you need to connect the signal "y'" to a "Math" block which performs a square operation:
Next, the right-hand side has "-y", which requires you to multiply the "y" signal with "-1". To do this, you can use the "Unary Minus" block:
Finally, the right-hand side multiplies "-y" and the square of the first-order derivative. You can use the "Product" block to multiply the two signals:
The output of the "Product" block models the right-hand side of the equation. On the left-hand side, you only have the second-order derivative. Since the second-order derivative equals the right-hand side, you need to connect output of the "Product" block to the input of the first "Integrator" block:
This models the complete equation. You can then connect a "Scope" block to the "y" signal and set the initial conditions in the "Integrator" blocks. The output of the scope is shown below:
Please refer to the following resources for more information:
If you want to learn more about Simulink, you can take the Simulink Onramp course on MATLAB Academy: https://matlabacademy.mathworks.com/details/simulink-onramp/simulink.
Hope this helps!

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by