This error keeps popping up and I have no idea why: Error using viscircles Expected input number 1, centers, to be real. Error in viscircles>validateCentersAndRadii (line 283) validateattributes(centers,{'numeric'},{'nonsparse','real', ... Erro
Mostra commenti meno recenti
I am trying to do an animation for a linkage system and it is not plotting one of the links for some reason.
P1_pos = [56.25;43.1];
P2_pos = [56.25-A*cos(theta);43.1-A*sin(theta)];
P4_pos = C*[0;1];
P5_pos = D*[0*sin(theta);-1+1*sin(theta)]; %P5_pos = D*[0;-1+sin(theta)];
E = sqrt(A^2 + D^2 - 2*A*D*cos(theta));
a = asin(A*sin(theta)./E);
b = acos(E.^2 + C^2 - B^2)./(2*E*C);
P3_pos = [C + B*cos(a+b); B*sin(a+b)];
P5x = P5_pos(1,:);
P5y = P5_pos(:,1);
P5vx = diff(P5x);
P5vy = diff(P5y);
P5v = sqrt(P5vx.^2 + P5vy.^2);
ani = subplot(2,1,1);
P1_pos_cir = viscircles(P1_pos',0.05);
P2_pos_cir = viscircles(P2_pos(:,i)',0.05);
P3_pos_cir = viscircles(P3_pos(:,i)',0.05);
P4_pos_cir = viscircles(P4_pos',0.05);
P5_pos_cir = viscircles(P5_pos(:,i)',0.05);
6 Commenti
KALYAN ACHARJYA
il 4 Dic 2019
A?
dpb
il 4 Dic 2019
Don't put message in title...truncated error message.
We can't test as don't have constants but the obvious problem is that one (or more) of your Px_pos values is complex. E is the most likely culprit it would appear.
Use the debugger and see what is going on...
Matthew Palermo
il 4 Dic 2019
P3_pos_cir = viscircles(P3_pos(:,i)',0.05);
Is this inside a loop of the construct for i = 1:n ?
I don't see a for statement here, and i is default to sqrt(-1) in matlab, unless you reassign it.
dpb
il 4 Dic 2019
Yeah, I noticed that too, but that's using i as an array index which would be another error on indexing must be real and positive...
Matthew Palermo
il 5 Dic 2019
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!