Multiple inputs for one graph
Afficher commentaires plus anciens
I'm trying to figure out a way to attach 3 specific inputs so that they plot different points. Idealy the outputs are all on the same graph, but I'm having trouble with it. I also need to attach it into a GUI which I've never done before.
My curent attempt isn't great. Any help would be appreciated.
disp('Please input a weight and radius for one of the disks.')
UserInputs=input('Please choose a disk (Disk 1, Disk 2, Disk 3):','s')
if UserInputs==('Disk 1')
kg_1=input('Weight: \n');
r_1=input('Radius: \n');
elseif UserInputs==('Disk 2')
kg_2=input('Weight: \n');
r_2=input('Radius: \n');
elseif UserInputs==('Disk 3')
kg_3=input('Weight: \n');
r_3=input('Radius: \n');
end
switch UserInputs
case 'Disk 1'
figure(1)
plot(x1,y1)
case 'Disk 2'
figure(1)
plot(x2,y2)
case 'Disk 3'
figure(1)
plot(x3,y3)
end
x1=1
x2=2;
x3=3;
y1=(1./2).*kg_1.*r_1.^2
y2=(1./2).*kg_2.*r_2.^2
y3=(1./2).*kg_3.*r_3.^2
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!