i have:
P3=[l1 - (l3y*(2*c3 - 2*c1*c2))/c_delta + (l3z*(2*c2 + 2*c1*c3))/c_delta + (l3x*(c1^2 - c2^2 - c3^3 + 1))/c_delta;
(l3x*(2*c2 + 2*c1*c2))/c_delta (l3y*(c1^2 - c2^2 + c3^2 - 1))/c_delta - (l3z*(2*c1 - 2*c2*c3))/c_delta;
(l3y*(2*c2 + 2*c2*c3))/c_delta - (l3x*(2*c2 - 2*c1*c3))/c_delta - (l3z*(c1^2 + c2^2 - c3^2 - 1))/c_delta]
P4=[p4x+0.9972s;p4y-0.0712s;p4z-0.0216s];
l4=P4-P3;
i have to do this product:
(P4-P3)⋅(P4-P3) - l4^2=0.
when I calculate this matlab equation it gives me back the conjugate complexes that I don't want, why?

6 Kommentare

Matthew Mishrikey
Matthew Mishrikey am 4 Jan. 2022
please provide a script with values for all these variables.
I assume you are using .* and .^ (element-wise operations).
sebastiano della gatta
sebastiano della gatta am 4 Jan. 2022
These variables are all symbolic so the equation that i need is in symbolic form. No i didn't use .* and .^ because it isn't the same operation that i need.
Walter Roberson
Walter Roberson am 4 Jan. 2022
P4=[p4x+0.9972s;p4y-0.0712s;p4z-0.0216s]; is not valid matlab syntax so we can tell that you did not post your actual code.
Walter Roberson
Walter Roberson am 4 Jan. 2022
(l3x*(2*c2 + 2*c1*c2))/c_delta (l3y*(c1^2 - c2^2 + c3^2 - 1))/c_delta - (l3z*(2*c1 - 2*c2*c3))/c_delta;
That code has a space between c_delta and what follows. Inside [] a space between expressions and no operator present, is the same thing as horzcat. You have two columns in that row. But you only have one column in the other rows. Unless you have an empty variable so that one of the two columns degrades to empty, the code is in error.
Star Strider
Star Strider am 5 Jan. 2022
Put each line in parentheses (the trailing semicolons are outside the parentheses). That generally solves the problem that spaces create, and preserves the readability of the code.
sebastiano della gatta
sebastiano della gatta am 5 Jan. 2022
Bearbeitet: Walter Roberson am 5 Jan. 2022
clear all; clc; close all;
syms theta l1 o_1x o_1y o_1z s p4x p4y p4z c1 c2 c3 c_delta l3x l3y l3z
betan=[-1.534,0.019,0.072];
Rz0=[1 0 0;0 cos(theta) -sin(theta);0 sin(theta) cos(theta)];
l1=[l1;0;0];
A=Rz0*l1;
P1=0+A;
R=1/c_delta*[1+c1^2-c2^2-c3^3 2*(c1*c2-c3) 2*(c1*c3+c2);2*(c1*c2+c2) 1-c1^2+c2^2-c3^2 2*(c2*c3-c1);2*(c1*c3-c2) 2*(c2*c3+c2) 1-c1^2-c2^2+c3^2];
l3=[l3x;l3y;l3z];
R01=R*l3;
P3=P1+R01;
Rzb=[1 0 0; 0 cos(-1.534) -sin(-1.534); 0 sin(-1.534) cos(-1.534)];
Ryb2=[cos(0.019) -sin(0.019) 0;sin(0.019) cos(0.019) 0; 0 0 1];
Rxb3=[cos(0.072) 0 sin(0.072);0 1 0;-sin(0.072) 0 cos(0.072)];
R02=Rzb*Ryb2*Rxb3;
v=[s;0;0];
s=R02*v;
P=[p4x;p4y;p4z];
P4=(P+s);
l4=P4-P3;
(P4-P3)·(P4-P3)-l4^2=0
it is not equal to zero because you do the scalar product first and then the subtraction but when I do this I get complex numbers that I don't want, how can I solve?

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

laurent jalabert
laurent jalabert am 5 Jan. 2022

0 Stimmen

Hello, maybe I did not understood your problem cause l4=P4-P3; and you want to solve:
(P4-P3)⋅(P4-P3) - l4^2=0, which means (P4-P3)⋅(P4-P3) - (P4-P3)^2 = 0
Do you mean (P4-P3).*(P4-P3) - (P4-P3).^2 = 0 ? which is 0=0

1 Kommentar

sebastiano della gatta
sebastiano della gatta am 5 Jan. 2022
it is not equal to zero because i don't have to use .* because is another operation.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics and Optimization finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by