On the same figure plot all four obtained powers in kW against time. Use different line styles for each power, e.g. solid line, dashed line, dotted line or dash-dot line. Add labels to all axes. Add title, legend and grid to the figure.
t = 0:1:100; %Time Step
Load = 10; % Ohms
P=[ ]; %power
Vel = [ ]; %Speed
Gear= [ ]; %Gear
SOC = [ ]; %Soc
V = [ ]; %Voltage
A = [ ]; %Current
for r=1:length(t)
V(r)=100*rand;
A(r) = V(r)/Load;
P(r) = V(r) * A(r);
Vel(r) = V(r)*rand();
SOC(r) = Vel(r)*rand;
Gear(r) = SOC(r)*rand();
end
scrsz = get(0,'ScreenSize');
Dim=0;
figure('Position',[scrsz(1)+Dim, scrsz(2)+Dim,scrsz(3)-20,scrsz(4)-100]);
close all,
clear all,
clc,
t = 0:1:100; %Time Step
Load = 10; % Ohms
P=[]; %power
Vel = []; %Speed
Gear= []; %Gear
SOC = []; %Soc
V = []; %Voltage
A = []; %Current
for r=1:length(t)
V(r)=100*rand;
A(r) = V(r)/Load;
P(r) = V(r) * A(r);
Vel(r) = V(r)*rand();
SOC(r) = Vel(r)*rand;
Gear(r) = SOC(r)*rand();
end
scrsz = get(0,'ScreenSize');
Dim=0;
figure('Position',[scrsz(1)+Dim, scrsz(2)+Dim,scrsz(3)-20,scrsz(4)-100]);
subplot(3,2,1);
plot(t,V,'r'); grid on, hold on,
xlabel('--- Time(t) --->');
ylabel('--- Voltage (V) --->');
title('Plot: Voltage','FontSize',20);
subplot(3,2,2);
plot(t,A,'g'); grid on, hold on,
xlabel('--- Time(t) --->');
ylabel('--- Current(A) --->');
title('Plot: Current (A)','FontSize',20);
subplot(3,2,3);
plot(t,P,'b'); grid on, hold on,
xlabel('--- Time(t) --->');
ylabel('--- Power --->');
title('Plot: Power','FontSize',20);
subplot(3,2,4);
plot(t,Vel,'k'); grid on, hold on,
xlabel('--- Time(t) --->');
ylabel('--- Speed --->');
title('Plot: Speed','FontSize',20);
subplot(3,2,5);
plot(t,SOC,'m'); grid on, hold on,
xlabel('--- Time(t) --->');
ylabel('--- SOC --->');
title('Plot: SOC','FontSize',20);
subplot(3,2,6);
plot(t,Gear,'c'); grid on, hold on,
xlabel('--- Time(t) --->');
ylabel('--- Gear --->');
title('Plot: Gear','FontSize',20);
Comments
Leave a comment