Sample Time in From Workspace Block
조회 수: 4 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
Sameer
2025년 5월 6일
Hi @Carlos
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!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!