Generating lines and circles
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
basically i have to create a algorithm where the user (my teacher) has to input all the data and anything he inputs has to work. He is supposed to open the program and choose which algorithm to use from the following three: line drawing (like a segment from point A to point B), function (sin/cos etc) and circle drawing algorithm. Problem is I have no idea what i'm doing. Here is what i've done so far:
in = input('Would you like to draw a function(FCT), a segment(DR) or a circle(CRC)?');
if strcmpi(in, 'FCT') %here it is supposed to run the function algorithm and using used input data,
%and display on screen the graphic (the sin/cos i mean..) and ignore
%the rest of the algorithm
{
inx0=input('\nx0');
iny0=input('\ny0');
x=[inx0];
y=[iny0];
plot(x,y);
}
elseif strcmpi(in, 'DR') %otherwise if the user chooses the line, it needs to diplay it and ignore
%the rest of the algorithm
{
inx0=input('\nx0');
inx1=input('\nx1');
iny0=input('\ny0');
iny1=input('\ny1');
x=[inx0,inx1];
y=[iny0,iny1];
plot(x,y);
}
elseif strcmpi(in, 'CRC') %if the used chooses the circle, the same as the above.. it has to diplay it
%for this algorithm i didn't even knew how to start
{
}
else
error('Please answer one of the following possible answers:: "FCT/DR/CRC".'); %if the used types
%any answer other than those 3, he needs to be redirected to
%the question and answer it properly.
end
hold on
grid on
axis equal
If anone would be so kind to make it, I'd be forever in your debt.
Kind regards,
T.
0 comentarios
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!