How can i get this function to work with this spreadsheet
Ältere Kommentare anzeigen
function [L,B,C] = xyz2lbc(Xc,Yc,Zc,R)
if( (length(Xc) ~= length(Yc)) | (length(Xc) ~= length(Zc)) )
error('size');
end
if(nargin == 3)
R = zeros(1,length(Xc)-2);
elseif(length(R) == 1)
R = ones(1,length(Xc)-2).*R;
elseif(length(R) ~= length(Xc)-2)
error('R not match');
end
for i = 1:length(Xc)-2
V1 = [Xc(i)-Xc(i+1) ; Yc(i)-Yc(i+1) ; Zc(i)-Zc(i+1)];
V2 = [Xc(i+2)-Xc(i+1) ; Yc(i+2)-Yc(i+1) ; Zc(i+2)-Zc(i+1)];
V1l = Vlength(V1);
V2l = Vlength(V2);
C(i) = pi - acos(dot(V1,V2) / (V1l*V2l));
planeV(i,:) = cross(V1,V2)';
if(i>1)
Y(i) = Y(i) - R(i)*tan(C(i)/2);
Y(i+1) = V2l - R(i)*tan(C(i)/2);
PV1l = Vlength(planeV(i-1,:));
PV2l = Vlength(planeV(i,:));
s=sign(V1 .* cross(planeV(i-1,:),planeV(i,:))');
B(i) = acos(dot(planeV(i-1,:),planeV(i,:))/(PV1l*PV2l))*s(1);
else
Y(i) = V1l - R(i)*tan(C(i)/2);
Y(i+1) = V2l - R(i)*tan(C(i)/2);
B(i) = 0;
end
end
2 Kommentare
It's unclear what you are asking.
On the one hand, we have a function with a meaningless name using variables with also meaningless names and absolutely no comment, so it's impossible to know what it's supposed to do. One thing is clear, it has nothing to do with spreadsheet
On the other hand, we have a spreadsheet (which we would have to download and open to even know what's in it).
No idea how the two relate to each other.
edit: and to top it off, the function defines its first output as L, yet never assigns anything to it, so it will result in an error every time it is called.
@Guillaume: it is clearly a super-secret test of super-intelligence, and anyone who cracks this super-cryptic question wins!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!