Info

This question is closed. Reopen it to edit or answer.

palce parameter value after using "solve" for a parametric eqn

1 view (last 30 days)
Im trying to place parameter values after I solved parametric eqn.
now Im using for loop and solving the eqn 360 times. is there any beter way to do so?
here is my code:
clear all,clc;
syms t2 t3 ;
a=30;b=60;c=50;d=70;
t3s=zeros(1,360);
for t1=1:1:360
eqns=[a*cosd(t1)+b*cosd(t2)+c*cosd(t3)==70,a*sind(t1)+b*sind(t2)+c*sind(t3)==0];
s=solve(eqns,t2,t3);
t3s(t1)=double(vpa(180+s.t3(2)));
%vpa(s.t2)
end

Answers (1)

darova
darova on 9 Apr 2020
Edited: darova on 9 Apr 2020
Maybe geometrical approach?
clc,clear
a = 30;
b = 60;
c = 50;
d = 70;
[t1,t2,t3] = meshgrid(0:20:360); % create 3D matrices for each variable
f1 = a*cosd(t1)+b*cosd(t2)+c*cosd(t3)-70;
f2 = a*sind(t1)+b*sind(t2)+c*sind(t3);
cla
p1 = isosurface(t1,t2,t3,f1,0); % first surface patch
p2 = isosurface(t1,t2,t3,f2,0); % second surface patch
patch(p1,'facecolor','r'); % display
patch(p2,'facecolor','b');
[~,fv] = SurfaceIntersection(p1,p2); % find intersection curves
patch('faces',fv.faces,...
'vertices',fv.vertices,...
'linewidth',2,...
'edgecolor','g')
axis vis3d equal
light

Products

Community Treasure Hunt

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

Start Hunting!