Clear Filters
Clear Filters

How do I simulate distributed systems described by PDEs in Simulink?

3 views (last 30 days)
I am in the process of simulating an open-channel irrigation canal in order to formulate and test control laws on it. It would help me greatly if I could perform such a simulation in Simulink, for visualization purposes.
I have the knowledge on how to solve a PDE numerically in MATLAB (Finite Difference Methods, Finite Volumes e.t.c.), but I have not found any examples on how to do it in Simulink. Can I perhaps utilize a function block to insert my simulation code inside it? If so, would the already discretized time steps of the "canal simulation block" need to be the same as the time steps of the larger Simulink simulation?
I apologise for the vague nature of my question, I am a bit new to Simulink.

Answers (1)

Rijuta
Rijuta on 24 Mar 2023
Hi Panagiotis,
I understand that you are trying to use a MATLAB Function block in Simulink to insert your canal simulation code inside it.
The MATLAB Function block allows you to write your own custom MATLAB code and integrate it directly into a Simulink model. To use a MATLAB Function block, you can simply create a new block in your Simulink model, then right-click on it and select "Edit Data Function". This will open a MATLAB editor window where you can write your custom MATLAB code.
To understand more about implementing MATLAB functions in Simulink, please refer to the documentation.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!