sampling time causes scaling of simulation results.

14 次查看(过去 30 天)
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;
end
if t(i) >= 5 %Rear wheel bump at 5 seconds
wf (2,i) = 0.1;
end
end
% 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);

采纳的回答

Star Strider
Star Strider 2020-11-27
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.
  6 个评论
ayman hussien
ayman hussien 2020-12-11
The gradient differentiation with respect to time worked. Thank you very much for your help.

请先登录,再进行评论。

更多回答(0 个)

类别

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

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by