From: Neil Pande on
I am new to matlab (simulink), so I don't have complete understanding of Simulink sample time.

I have created a simulink model with a step input, where my sample time is 0.0001. This model works well.

Now, instead of the step input, I want to apply an input using "From Workspace" block in simulink. If in matlab command window, you try to view my input, it looks like this: (its in columns)

customInput.signals.values =
[2.168 + i*3.755;
4.33692; 4.33692;
4.33692;
.... etc.
-2.168 + i*3.755;
4.33692;
4.33692]

customInput.time =
[0;
0.000033;
0.000066; 0
..00010;
0.000133;
0.000166;
0.0002;
0.000233;
.... etc.
3.33323;
3.33326;
3.33329;
3.33333]

I am trying to run my model with this input of time and values corresponding to the time. But I don't think Simulink is sampling inputs as precisely as I want. If I try to plot this in matlab, at the end of .m file, it looks the way I want (a PWM waveform), but if I do this in simulink, its missing a lot of cycles, and not square like my input. I have set the Sample Time in Simulink to 0.0001. I tried increasing it to 0.0000001 but Simulink crashed. How do I make Simulink sampling same as my "customInput.time"?

Also, I am using the "clock function" in simulink, to create a cosine wave of certain frequency, and multiply to each of my output. I want that clock to run same as my "customInput" sample time... i.e. I don't want that clock-time to be ahead of my "customInput" time and miss some outputs to multiply.

How do I do this?