How do I plot a function in terms of another function?

8 views (last 30 days)
x(1) = 1.1; % upper spring position
x(2) = 0.8; % lower spring position
x(3) = 0.95; % control arm length
x(4) = 0.6; % 0g angle (radians)
x(5) = 90e3; % spring constant (N/m)
alphamax = 0.6 * x(4); %maximum rotation for plotting
syms z
l1 = sqrt(x(1)^2+x(2)^2-2*x(1)*x(2)*cos(x(4))); %these are just kinematic equations with variable z
l2 = sqrt(x(1)^2+x(2)^2-2*x(1)*x(2)*cos(x(4)-z));
Fs = x(5)*(l1-l2);
phi = pi-x(4)+z-asin((x(2)/l2)*sin(x(4)-z));
Fsy = Fs*cos(phi-pi/2);
Fv = abs((Fsy*x(2))/(cos(x(4)-z)*x(3)));
eq1 = 2*x(3)*sin((pi+z)/2-x(4))*sin(z/2); %two equations
eq4 = Fv;
figure(4); clf %i can plot it independently but have an issue ploting eq4 against eq1.
fplot(eq4,[0,alphamax])
xlabel('alpha')
ylabel('vertical force')
How do i plot eq4 vs eq1? My professor had a solution, but it doesn't work with the way Ive done.
a = 0:0.01:alphamax; %prof's work
figure(5); clf
for i=1:length(a)
dt(i) = eq1(a(i),x); % vertical deflection at angle alpha = a(i)
fv(i) = eq4(a(i),x); % vertical force at angle alpha = a(i)
end
plot(dt,fv,'r-','LineWidth',2); hold on
xlabel('\delta_t');
ylabel('F_v');

Answers (1)

KSSV
KSSV on 22 Oct 2020
Try this:
a = 0:0.01:alphamax; %prof's work
figure(5); clf
for i=1:length(a)
dt(i) = double(subs(eq1(a(i),z))); % vertical deflection at angle alpha = a(i)
fv(i) = double(subs(eq4(a(i),z))); % vertical force at angle alpha = a(i)
end
plot(dt,fv,'r-','LineWidth',2); hold on
xlabel('\delta_t');
ylabel('F_v');

Tags

Products

Community Treasure Hunt

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

Start Hunting!