Getting a blank graph

2 views (last 30 days)
aakaar jaiswal on 13 Jun 2020
Edited: VBBV on 21 Jan 2022
My assignment is to graph the output angular velocity of a given universal joint. I have the equation and I am told to graph the function over the interval (0,2pi) or 0 to 360 degrees. I don't know why but my code is giving me a blank graph. Here's my code :
syms theta1 w1
grid on
theta1 = 0:pi/2:2*pi;
w2 = ((cos(pi/6)*(sec(theta1)).^2) / ((tan(theta1)).^2+(cos(pi/6)).^2))*2*pi;
plot(w2,theta1 ), xlabel('input angle'), ylabel('output velocity')

Ameer Hamza on 13 Jun 2020
Edited: Ameer Hamza on 13 Jun 2020
grid on
theta1 = 0:pi/2:2*pi;
w2 = ((cos(pi/6)*(sec(theta1)).^2)./((tan(theta1)).^2+(cos(pi/6)).^2))*2*pi;
%^ use elementwise division operator
plot(w2,theta1 ), xlabel('input angle'), ylabel('output velocity')

VBBV on 21 Jan 2022
Edited: VBBV on 21 Jan 2022
syms theta1
grid on
w2 = @(theta1) ((cos(pi/6)*(sec(theta1)).^2)./ ((tan(theta1)).^2+(cos(pi/6)).^2))*2*pi;
theta1 = 0:pi/2:2*pi;
plot(w2(theta1),theta1 );
xlabel('input angle');
ylabel('output velocity');
You can try using anonymous function output