Variable Input for State Space

4 次查看(过去 30 天)
Carlos
Carlos 2016-2-24
回答: Sameer 2025-5-6
Hello, I am working with a model in Simulink and I have the State Space. Now, the input (a temperature) is constant, but I want that that temperature varies respect on time. I have a matrix with information about that Temperature and the time that the sensor took that. Which is the best way to do that?
I would like to do something similar that the "Random Number" does, but with my data, which is not random.
Thank you so much for your help.

回答(1 个)

Sameer
Sameer 2025-5-6
You can use your time-varying temperature data as an input in Simulink! Here are a couple of straightforward ways I have used before:
1. From Workspace block:
  • Arrange your data as an N-by-2 matrix: first column is time, second is temperature.
  • For example: temp_data = [time_vector, temperature_vector];
  • In Simulink, add a "From Workspace" block, set its Data parameter to your matrix (e.g., temp_data), and connect it to your State-Space block.
  • The block will output your temperature values at the correct simulation times, interpolating as needed.
2. 1-D Lookup Table:
  • Use your time as breakpoints and temperature as table data.
  • Feed simulation time (from a "Clock" block) into the lookup table, and connect the output to your State-Space block.
  • This way, you have more control over interpolation/extrapolation if needed.
Both methods let you use your recorded temperature data as a dynamic input, rather than a constant.
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by