Sample Time in From Workspace Block

5 次查看(过去 30 天)
Carlos
Carlos 2016-3-7
回答: Sameer 2025-5-6
Hello, I have some model that uses temperature data collected for one year. If I use as an input a sinusoidal signal, my output follows the correct model, but, if I put my data signal it does not follow the model. I think that the problem is that my input signal (data and time) has a total length of 9000, but if I try to plot it, it is using just 300 aprox. Is there any way to use the sample time exact that is in my data?
Thank you.

回答(1 个)

Sameer
Sameer 2025-5-6
To make Simulink use the exact sample times from your data with the "From Workspace" block:
1. Format your data as a two-column matrix:The first column is time, the second is your signal.
codedata = [time_vector, signal_vector];
2. Set the From Workspace block’s "Sample time" to -1:This tells Simulink to use the time values from your data instead of a fixed sample time.
3. Set the simulation Start and Stop times to match the range of your time data (e.g., Start time = time_vector(1), Stop time = time_vector(end)).
This way, Simulink will use all your data points at the exact times you have in your file.
Hope this helps!

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by