How to display graph data by vehicle center of gravity in the Data Inspector in Simulink?
Hi I am working my way through the Vehicle Steering Gain at Different Speeds example.
In that example,
vmax = [45, 50, 55];
numExperiments = length(vmax);
to show the values from speeds 45 to 55 in the data inspector. I would like to replace the declared speed values with the vehicle’s center of gravity (VEH.FrontAxlePositionfromCG, VEH.RearAxlePositionfromCG, VEH.HeightCG) specified in parentheses and show them in the data inspector.
But I don’t know how…
In the Vehicle Steering Gain at Different Speeds example above, the command to represent the data inspector based on speed would look like the command below.
for idx = 1:numExperiments
% Create sdi run object
simoutRun(idx)=Simulink.sdi.Run.create;
simoutRun(idx).Name=[‘Velocity = ‘, num2str(vmax(idx))];
add(simoutRun(idx),’vars’,simout(idx));
end
sigcolor=[0 1 0;0 0 1;1 0 1];
for idx = 1:numExperiments
% Extract the lateral acceleration, position, and steering
msignal(idx)=getSignalsByName(simoutRun(idx), ‘xdot_mph’);
msignal(idx).LineColor =sigcolor((idx),:);
ssignal(idx)=getSignalsByName(simoutRun(idx), ‘SteerAngle’);
ssignal(idx).LineColor =sigcolor((idx),:);
asignal(idx)=getSignalsByName(simoutRun(idx), ‘Lateral acceleration’);
asignal(idx).LineColor =sigcolor((idx),:);
xsignal(idx)=getSignalsByName(simoutRun(idx), ‘Passenger Vehicle:1.Body.InertFrm.Cg.Disp.X’);
xsignal(idx).LineColor =sigcolor((idx),:);
ysignal(idx)=getSignalsByName(simoutRun(idx), ‘Passenger Vehicle:1.Body.InertFrm.Cg.Disp.Y’);
ysignal(idx).LineColor =sigcolor((idx),:);
end
Simulink.sdi.view
Simulink.sdi.setSubPlotLayout(5,1);
for idx = 1:numExperiments
% Plot the lateral position, steering angle, and lateral acceleration
plotOnSubPlot(msignal(idx),1,1,true);
plotOnSubPlot(ssignal(idx),2,1,true);
plotOnSubPlot(asignal(idx),3,1,true);
plotOnSubPlot(xsignal(idx),4,1,true);
plotOnSubPlot(ysignal(idx),5,1,true);
end
Translated with www.DeepL.com/Translator (free version)Hi I am working my way through the Vehicle Steering Gain at Different Speeds example.
In that example,
vmax = [45, 50, 55];
numExperiments = length(vmax);
to show the values from speeds 45 to 55 in the data inspector. I would like to replace the declared speed values with the vehicle’s center of gravity (VEH.FrontAxlePositionfromCG, VEH.RearAxlePositionfromCG, VEH.HeightCG) specified in parentheses and show them in the data inspector.
But I don’t know how…
In the Vehicle Steering Gain at Different Speeds example above, the command to represent the data inspector based on speed would look like the command below.
for idx = 1:numExperiments
% Create sdi run object
simoutRun(idx)=Simulink.sdi.Run.create;
simoutRun(idx).Name=[‘Velocity = ‘, num2str(vmax(idx))];
add(simoutRun(idx),’vars’,simout(idx));
end
sigcolor=[0 1 0;0 0 1;1 0 1];
for idx = 1:numExperiments
% Extract the lateral acceleration, position, and steering
msignal(idx)=getSignalsByName(simoutRun(idx), ‘xdot_mph’);
msignal(idx).LineColor =sigcolor((idx),:);
ssignal(idx)=getSignalsByName(simoutRun(idx), ‘SteerAngle’);
ssignal(idx).LineColor =sigcolor((idx),:);
asignal(idx)=getSignalsByName(simoutRun(idx), ‘Lateral acceleration’);
asignal(idx).LineColor =sigcolor((idx),:);
xsignal(idx)=getSignalsByName(simoutRun(idx), ‘Passenger Vehicle:1.Body.InertFrm.Cg.Disp.X’);
xsignal(idx).LineColor =sigcolor((idx),:);
ysignal(idx)=getSignalsByName(simoutRun(idx), ‘Passenger Vehicle:1.Body.InertFrm.Cg.Disp.Y’);
ysignal(idx).LineColor =sigcolor((idx),:);
end
Simulink.sdi.view
Simulink.sdi.setSubPlotLayout(5,1);
for idx = 1:numExperiments
% Plot the lateral position, steering angle, and lateral acceleration
plotOnSubPlot(msignal(idx),1,1,true);
plotOnSubPlot(ssignal(idx),2,1,true);
plotOnSubPlot(asignal(idx),3,1,true);
plotOnSubPlot(xsignal(idx),4,1,true);
plotOnSubPlot(ysignal(idx),5,1,true);
end
Translated with www.DeepL.com/Translator (free version) Hi I am working my way through the Vehicle Steering Gain at Different Speeds example.
In that example,
vmax = [45, 50, 55];
numExperiments = length(vmax);
to show the values from speeds 45 to 55 in the data inspector. I would like to replace the declared speed values with the vehicle’s center of gravity (VEH.FrontAxlePositionfromCG, VEH.RearAxlePositionfromCG, VEH.HeightCG) specified in parentheses and show them in the data inspector.
But I don’t know how…
In the Vehicle Steering Gain at Different Speeds example above, the command to represent the data inspector based on speed would look like the command below.
for idx = 1:numExperiments
% Create sdi run object
simoutRun(idx)=Simulink.sdi.Run.create;
simoutRun(idx).Name=[‘Velocity = ‘, num2str(vmax(idx))];
add(simoutRun(idx),’vars’,simout(idx));
end
sigcolor=[0 1 0;0 0 1;1 0 1];
for idx = 1:numExperiments
% Extract the lateral acceleration, position, and steering
msignal(idx)=getSignalsByName(simoutRun(idx), ‘xdot_mph’);
msignal(idx).LineColor =sigcolor((idx),:);
ssignal(idx)=getSignalsByName(simoutRun(idx), ‘SteerAngle’);
ssignal(idx).LineColor =sigcolor((idx),:);
asignal(idx)=getSignalsByName(simoutRun(idx), ‘Lateral acceleration’);
asignal(idx).LineColor =sigcolor((idx),:);
xsignal(idx)=getSignalsByName(simoutRun(idx), ‘Passenger Vehicle:1.Body.InertFrm.Cg.Disp.X’);
xsignal(idx).LineColor =sigcolor((idx),:);
ysignal(idx)=getSignalsByName(simoutRun(idx), ‘Passenger Vehicle:1.Body.InertFrm.Cg.Disp.Y’);
ysignal(idx).LineColor =sigcolor((idx),:);
end
Simulink.sdi.view
Simulink.sdi.setSubPlotLayout(5,1);
for idx = 1:numExperiments
% Plot the lateral position, steering angle, and lateral acceleration
plotOnSubPlot(msignal(idx),1,1,true);
plotOnSubPlot(ssignal(idx),2,1,true);
plotOnSubPlot(asignal(idx),3,1,true);
plotOnSubPlot(xsignal(idx),4,1,true);
plotOnSubPlot(ysignal(idx),5,1,true);
end
Translated with www.DeepL.com/Translator (free version) vehicle steering gain at different speeds, simulink MATLAB Answers — New Questions