graphs dnt show anymore, eventhough the values are shown in the workspace.

3 次查看(过去 30 天)
Hi,
As you can see from the image I attached. I get my values in the workspace, but suddenly the graphs do not show anymore. Before that the graphs were shown. I did not change anything. Does anyone know whats wrong? URGENT
  2 个评论
Dyuman Joshi
Dyuman Joshi 2024-3-21
As it is "URGENT", we can not run a badly taken screenshot.
Copy and paste your code here and provide all necessary files needed to run it.
sadat golz
sadat golz 2024-3-21
clc % clears all inputs and outputs from the command window
clear all % clears all data in the workspace of matlab
close all % close all figures produced by matlab
%% Define vehicle paramteters
v = 30/3.6; % vehicle speed [m/s]
a = 1.329; % lenght from front axle to COG [m]
b = 1.561; % length from rear axle to COG [m]
L = a+b; % wheelbase [m]
I_yy = 4346.60; % moment of inertia [kgm^2]
t_delay= L/v; % time delay between the front axle and rear axle [s]
%% Define spring parameters
C_f = 58982.63; % front spring stiffnes [N/m]
C_r = 58982.63; % rear spring stiffness [N/m]
k_f = 7006.15; % front damping constant [Ns/m]
k_r = 7006.15; % rear damping constant [Ns/m]
%% Define vehicle mass distribution
m_tot = 2405; % total vehicle mass [kg]
m_c = m_tot*(1-(I_yy/(m_tot*a*b))); % coupling mass [kg]
m_f = (I_yy/(a*(a+b))); % 46% mass at the front axle [kg]
m_r = (I_yy/(b*(a+b))); % 54% mass at the rear axle [kg]
%% Define obstacle parameter
z_i=0.1; % speed bump's height [m]
%% Signal builder and ploting the graphs
% for creating the vertical displacement, a signal builder is used to represent a speed bumpers height of 0.1 [m]
% we must take the time delay between front axle and the rear axle into
% consideration
disp('script to illustrate the graph')
% defining four set points in the signal builder
% 1st point
t1 = 0;
y1 = 0;
% 2nd point
t2 = 1/v;
y2 = 0;
% 3rd point
t3 = 2/v;
y3 = 0.1;
% 4th point
t4 = 3/v;
y4 = 0.1;
% 5th point
t5 = 4/v;
y5 = 0;
% 6th point
t6 = 5/v;
y6 = 0;
% defining the points in array
t = [t1 t2 t3 t4 t5 t6];
y = [y1 y2 y3 y4 y5 y6];
% defining the array in the signal builder where z_1 is the signal input ofthe model
signalbuilder('AUM4_MV_portfolio_sim/speed_bumper','set','speed_bumper','Group 1',t,y)
% simulating the simulink model
sim('AUM4_MV_portfolio_sim')
% graph 1: sprung mass vs road input vs time
subplot(3,1,1)
plot1 = plot(tout,disp_front,'blue',tout,disp_rear,'red',tout,speed_bump,'green');
legend('Sprung mass front','Sprung mass rear', 'Speed bumper')
grid on
xlabel('Time [s]')
ylabel('Displacement [m]')
title 'Front & rear displacement'
% graph 2: pitch vs time
subplot(3,1,2)
plot3 = plot(tout,pitch_angle);
legend('Pitch angle')
grid on
xlabel('Time [s]')
ylabel('Pitch[radians]')
title 'Pitch angle'
% graph 3: suspension forces vs time
subplot (3,1,3)
plot2 = plot(tout,spring_force_front,tout,spring_force_rear);
legend('Suspension force front','Suspension force rear')
grid on
xlabel('Time[s]')
ylabel('Force[N]')
title 'Suspension forces'

请先登录,再进行评论。

采纳的回答

Voss
Voss 2024-3-21
There is no variable "speed_bump" in the workspace; perhaps you meant "speed_bumper".

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by