Using "from file block" not working

3 visualizaciones (últimos 30 días)
David Rojas
David Rojas el 30 de Ag. de 2019
Respondida: David Rojas el 31 de Ag. de 2019
Hi,
I'm trying to plot (using Scope) in Simulink the values of a potentiometer and the time this data was recorded from a .mat file from Matlab. My intention is to do something more complex but I have to understand how the block works. It looks easy but I cannot get Simulink running more than 10 seconds and the timestamps are 152 seconds.
I explain the steps I did and maybe you can guess where is my error:
Well, first of all here it is my easy block and scope, easy:
1.JPG
The block parameters are the following ones:
2.JPG
The .mat file is as follows:
3.JPG
4.JPG
5.JPG
The thing is that when I do the simulation it only makes this:
As you can see it only runs until 10 seconds and I want Simulink to plot every point of data of the second row with the matching point of time of the first row but I can't find the way.
6.JPG
Thank you in advance

Respuestas (2)

Fangjun Jiang
Fangjun Jiang el 30 de Ag. de 2019
Change your simulation "Stop Time" from 10 (default) to whaever you want.
  1 comentario
David Rojas
David Rojas el 30 de Ag. de 2019
This I have tried already, it is the first thing I tried and I also set a stop simulation block like shown below but maybe I did not explained myself properly. What I want is to do a model that takes the first element of the .mat file (row 2 column 1) and pass it through the simulation blocks and this data point corresponds to the time of the .mat file (row 1 column 1), then take the second element (row 2 column 2) and do the same, the time here will be row 1 column 2 and so on. When all the data points will be done then I get the result. There is an example below as well.
This is the previous question but with the stop simulation block.
7.JPG
This is the complete example that have to take all data points one by one and check if it is a valid point, then the next one and so on. You will see that I want to detect if the values are increasing so I have to check:
If the first point of pedal is equal to 100
Check if speed is higher than 5
Check if the potentiometer values are increasing
Then go to the next point and do the same.
8.JPG
Thank you

Iniciar sesión para comentar.


David Rojas
David Rojas el 31 de Ag. de 2019
Ok, I managed to do it but now I have another question. I did everything to read the potentiometer values and I want to integrate the time only when the values are increasing. I did the model with logic operators to get only the values I need and it is doing what I want but Simulink generates a ramp when the values go to 0 that I don't want and I cannot get rid off.
Do you know why this happens? See the picture below, the green line is the one that I want but it has a decreasing ramp and it should go to 0 suddenly.
1.JPG

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by