linecirc error for input arguments of type double

hiya,
im trying to use the linecirc function to find the intersection of a circle and a straight line, however i am getting the error "Undefined function 'linecirc' for input arguments of type 'double'.". I have been unable to find a toolbox for it, so i am assuming its a default function for MATLAB and from what i understand the double data type is the default for all numbers stored in matlab. Im quite new so am just trying to work it all out. any help would be much apreciated

 Accepted Answer

This should not be a problem.
Please have a look at this code snippet:
clear
clc
close all
% Radius
R = 2;
t = linspace(0, 2*pi);
% Center coordinates
xcenter = 1;
ycenter = 2;
xc = R*cos(t) + xcenter;
yc = R*sin(t) + ycenter;
axis equal
hold on; grid on;
plot(xc,yc);
% Plot line
slope = 1;
intercpt = -1.5;
xl = linspace(-1,4);
yl = slope*xl + intercpt;
plot(xl,yl)
[xout,yout] = linecirc(slope,intercpt,xcenter,ycenter,R)
xout = 1×2
2.9114 1.5886
yout = 1×2
1.4114 0.0886

1 Comment

think i got it now. didnt have the mapping toolbox installed. thank you

Sign in to comment.

More Answers (0)

Categories

Products

Community Treasure Hunt

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

Start Hunting!