Jasmine
Jasmine

Reputation: 1

Plotting forces in Matlab

I need help plotting Fbr_ideal vs. Fbf_ideal equations in matlab. Currently, I'm receiving a blank graph.

clear all
close all
a=987.2; % Front axle to CG, mm
L=2468; % Wheelbase, mm
b=L-a; % Rear axle to CG, mm
h=517; % Height of CG
w=3698.17;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Index of terms
% Ff= ratio of Fbf to Wf
% Fr= ratio of Fbr to Wr
% ao= the ratio of ax/g
% Kbf,Kbr= respective brake distribution at fron and rear
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Ideal Distribution
ao=0.2:0.1:1;
Fbf_ideal=(ao.*(b/L).*w)/(1-(ao.*(h/L)));
Fbr_ideal=(ao.*(a/L).*w)/(1+(ao.*(h/L)));
plot(Fbf_ideal,Fbr_ideal,"linewidth",2)
hold on
xlabel("Front Brake Force")
ylabel("Rear Brake Force")
title("Brake Proportioning Curve")
grid

enter image description here

Upvotes: 0

Views: 93

Answers (1)

rinkert
rinkert

Reputation: 6863

That is because Fbf_ideal and Fbr_ideal are scalars, not arrays as you probably want. You probably want to use element wise division:

Fbf_ideal=(ao.*(b/L).*w)/(1-(ao.*(h/L)));
%                       ^ replace with ./

To following will plot the horizontal and vertical lines from the axis to the data points.

plot([Fbf_ideal;Fbf_ideal], [zeros(size(Fbf_ideal)); Fbr_ideal], 'k')
plot([zeros(size(Fbf_ideal)); Fbf_ideal], [Fbr_ideal; Fbr_ideal], 'k')

Upvotes: 1

Related Questions