MATLAB Answers

sampling time causes scaling of simulation results.

1 view (last 30 days)
I am trying to model a dynamic system's response against a generated signal.
i modeled the system properly on simulink and it worked fine, but for the purpose of my work i needed to replicate the same simulation in a less abstract manner because i need to control the parameters of the simulation and solution a bit further.
I've managed to do so on matlab but i am facing a problem caused by sampling time scaling.
I know and understand that sampling time affects the accuracy of the simulation but at a certain threshold sampling time should be small enough that it doesn't affect the results any more.
the problem i am facing is that changing sampling time causes direct scaling of the end results of the simulation.
For example
a sample time of .001 gives the same result as a sample time of .01 only it is multiplied by 10^-1.
My question is
  1. is their a way to eliminate the scaling relation between sampling time and results ?
  2. if i am trying to manually do the math for the simulation (which i am trying to do) is their a way to manually do variable time sampling ?
  3. if the scaling effect is a fact i have to accept, how to choose the best possible sample time.
thanks in advance and sorry for the long question
t = 0:0.025:15;
for i = 1:length(t)
if t(i) >= 1 %Front wheel bump at 1 seconds
wf(1,i) = 0.1;
if t(i) >= 5 %Rear wheel bump at 5 seconds
wf (2,i) = 0.1;
% input differentiation
wf1 = wf (1,:); wf2 = wf (2,:);
w = [diff(wf1) , 0 ; diff(wf2) , 0];
Susp_sys = ss((A-B*K),G,C,D);
[Y,T,x] = lsim (Susp_sys,w,t);


Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 27 Nov 2020
It may be appropriate to specify the the sampling time in the ss call. See Create Discrete-Time State-Space Model.
Another possibility is that there could be a difference in the assumed time units in the model and the assumed time units in the simulation.


Show 3 older comments
Star Strider
Star Strider on 2 Dec 2020
My pleasure.
I will delete my Answer in a few hours.
ayman hussien
ayman hussien on 11 Dec 2020
The gradient differentiation with respect to time worked. Thank you very much for your help.

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!