What is the error? 1, fast

1 visualización (últimos 30 días)
megan
megan el 15 de Mayo de 2021
Comentada: Rik el 22 de Mayo de 2021
clc;
clear;
close;
global th_3 th_5 R L4 L5 L3 th_2
R=5;
L3=19;
L4=44;
L5=31;
n=1; %num of rev
m=360*n; % num of dev of theta
acc=1;
a=1/acc;
th_r=linspace(0,2*pi ,m)
double th_2
%syms th_3 th_5 th_r
eg1= ((asin((L3*sind(th_3)-R*sind(th_r))/L5)) - th_5) ;
eg2= ((acos(-(R*cosd(th_r)+L5*cosd(th_5)-L4)/L3)) -th_3) ;
th_2 =( th_3-110)
th_r = th_r +a;
figure(1)
plot(th_2 , th_r)
grid on;
Message:
ans =
116 104 95 50
th_2 =
th_3 - 110
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
Error in Untitled3 (line 26)
plot(th_2 , th_r)
  5 comentarios
DGM
DGM el 15 de Mayo de 2021
Editada: DGM el 15 de Mayo de 2021
I know you want a plot of th_r versus th_2. That's what the plot command said. To be fair, I wasn't very clear. What I said was:
  • plot() doesn't handle symbolic expressions
  • th_2 is a function of th_3 and could be used if th_3 were a parameter in an fplot() call
  • but th_r is nonsense. What does it mean to plot 0==1? It's not a function of anything. It's a false assertion.
At least that's my impression of what's going on. Everyone is free to prove me wrong. It happens all the time.
Rik
Rik el 22 de Mayo de 2021
Just in case this questions gets a strange edit as well:
What is the error? 1, fast
clc;
clear;
close;
global th_3 th_5 R L4 L5 L3 th_2
R=5;
L3=19;
L4=44;
L5=31;
n=1; %num of rev
m=360*n; % num of dev of theta
acc=1;
a=1/acc;
th_r=linspace(0,2*pi ,m)
double th_2
%syms th_3 th_5 th_r
eg1= ((asin((L3*sind(th_3)-R*sind(th_r))/L5)) - th_5) ;
eg2= ((acos(-(R*cosd(th_r)+L5*cosd(th_5)-L4)/L3)) -th_3) ;
th_2 =( th_3-110)
th_r = th_r +a;
figure(1)
plot(th_2 , th_r)
grid on;
Message:
ans =
116 104 95 50
th_2 =
th_3 - 110
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
Error in Untitled3 (line 26)
plot(th_2 , th_r)

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 15 de Mayo de 2021
What I get is
Error using -
Matrix dimensions must agree.
Error in test (line 18)
eg1= ((asin((L3*sind(th_3)-R*sind(th_r))/L5)) - th_5) ;
and that is because th_3 and th_5 are empty. They are empty because you declared them as global, which created them as empty arrays. You cannot add a non-empty array to an empty array.
  8 comentarios
Image Analyst
Image Analyst el 18 de Mayo de 2021
So, which thread do you want to abandon, and which thread do you want to continue?
Also you didn't specify the rotation speed of each (I assume they're both the same), and the phase of one with respect to the other. Also, from your diagram, it looks like the windshield wipers go 360 degrees, which seems unrealistic since I think most go approximately 90 degrees. Why would a wiper go full circle???
Image Analyst
Image Analyst el 19 de Mayo de 2021
You said "theta z is gona 1 rev (from 0:360 deg)" which I took to mean "theta z is going to go through one revolution from 0 to 360 degrees). For that to happen I assumed the "x" wiper would have to go all the way around, 360 degrees.
Also you never answered my question about which thread you want to continue the conversation in (for the half day I have left before I'm off traveling until the end of the month), and didn't say what the phase difference between the wipers was. There is clearly a phase difference since your diagram does not show both wipers at the same angle at the same time. One is pointing to the left and one is pointing to the right.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by