Good day, I need help in building a reference signal from an ISO Specification. I have tried "create signal app"; however, it does not help much.
3 次查看(过去 30 天)
显示 更早的评论
The signal is specified on an ISO 16750-2 page 9. I would like to track this signal using a PI, PID, ISMC, and DSMC to assess the controller performance. Please see the attached signal.
Your help will be highly appreciated.
0 个评论
采纳的回答
Aquatris
2024-2-29
Something like this maybe
clc
tInit = 2; % initial Ub duration
tFin = 2; % final Ub duration
tr = 0.2;
t6 = 0.4;
t7 = 0.7;
t8 = 1;
tf = 40e-3;
Us = 8;
Ua = 9.5;
Ub = 12;
f = 9; % sine wave frequency [hz]
dt = 1e-3; % desired sampling time
t = 0:dt:(tInit+tr+t6+t7+t8+tf+tFin); % time vector
sig = NaN(size(t)); % initialize a sig variable
tt = 0; % misc variable to keep track of time while constructing the signal
% initial Ub
idx_tinit = find(t<tInit);
sig(idx_tinit) = Ub;
tt = tInit;
% tr section
idx_tr = find(t>=tt&t<tt+tr);
tt = tt+tr;
sig(idx_tr) = linspace(Ub,Us,length(idx_tr));
% t6 section
idx_t6 = find(t>=tt&t<tt+t6);
tt = tt+t6;
sig(idx_t6) = Us;
% t7 section
idx_t7 = find(t>=tt&t<tt+t7);
tt = tt+t7;
sig(idx_t7) = linspace(Us,Ua,length(idx_t7));
% t8 section
idx_t8 = find(t>=tt&t<tt+t8);
tt = tt+t8;
sig(idx_t8) = Ua-2*sin(2*pi*f*(t(idx_t8)-t(idx_t8(1))));
% tf section
idx_tf = find(t>=tt&t<tt+tf);
tt = tt+tf;
sig(idx_tf) = linspace(Ua,Ub,length(idx_tf));
% final Ub
idx_tfin = find(t>=tt&t<tt+tFin);
tt = tt+tFin;
sig(idx_tfin) = Ub;
plot(t,sig)
ylim([0 Ub+2])
xlabel('Time [sec]')
ylabel('Voltage [V]')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multibody Modeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!