how do I plot multiple points on the same graph?
76 views (last 30 days)
Show older comments
Im trying to create a graph using the coordinates in the code. When I hit run I recieve this message "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise,
check for mismatched delimiters." I'm also recieving 7 parse error codes in my plot line. Any help would be greatly appriciated
% declare initial variables
M1_mass1 = 10; % kilograms
M2_mass2 = 25; % kilograms
M3_mass3 = 50; % kilograms
M4_mass4 = 75; % kilograms
M5_mass5 = 95; % kilograms
M6_mass6 = 100; % kilograms
G_gravity = 9.8; % m/s^2
X_displacement_max = 0:.01:.10; % meters
% compute F_force
F_force1 = M1_mass1*G_gravity % newtons
F_force2 = M2_mass2*G_gravity % newtons
F_force3 = M3_mass3*G_gravity % newtons
F_force4 = M4_mass4*G_gravity % newtons
F_force5 = M5_mass5*G_gravity % newtons
F_force6 = M6_mass6*G_gravity % newtons
% compute K
K_springconstant0 = F_force1/0; % N/m
K_springconstant1 = F_force1/.02; % N/m
K_springconstant2 = F_force2/.04; % N/m
K_springconstant3 = F_force3/.05; % N/m
K_springconstant4 = F_force4/.06; % N/m
K_springconstant5 = F_force5/.08; % N/m
K_springconstant6 = F_force6/.10; % N/m
plot(0,98,c--,.02,245,c--,.04,490,c--,.05,735,c--,.06,931,c--,.08,931,c--,.10,980,c--)
0 Comments
Answers (1)
Walter Roberson
on 12 Sep 2021
plot(0, 98, 'c--', .02, 245, 'c--', .04, 490, 'c--', .05, 735, 'c--', .06, 931, 'c--', .08, 931, 'c--', .10, 980, 'c--')
0 Comments
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!