Clear Filters
Clear Filters

how to set marker on a specific point on an already existing curve...

1 view (last 30 days)
The problem I was given for homework is as follows: In the first mini-project with the ball rolling down the ramp, you solved for the theoretical velocity at the locations of Beam Break A and Beam Break B. Thinking back to Problem 3 of the Energy Conservation homework (HW1), plot the velocity of the ball as a function of distance ‘d’ down the incline (style is your choice). Also, plot the location and velocities of your beam break sensors as points. Add titles, axis labels, and a legend. Also modify the plot so it looks pretty. Yes, pretty is a subjective term. Make me love it
My equation for gthe ball rolling down our ramp is: v = sqrt((10/7)*(9.8.*d.*sind(12.39))) and I made "d" equal: d = [0:0.01:0.269875] as our ramp was 0.269875 meters long.
I have done every part of the problem except " plot[ting] the location and velocities of [my] beam break sensors as points." I therfeore need help in doing so.
This is my script file if this is of any help to whoever is attempting to solve this problem:
d = [0:0.01:0.269875]
v = sqrt((10/7)*(9.8.*d.*sind(12.39)))
plot(d,v,'-b')
xlabel('Distance (m)')
ylabel('Velocity (m/s)')
title('Velocity of Ball Bearing')
legend('Velocity')
grid on
Thanks.

Answers (1)

Abhishek Singh
Abhishek Singh on 10 Feb 2019
You can add:
hold on
plot(x_pos,y_pos,'r*')
to your code. (x_pos,y_pos) is the data point that needs to be marked. So, if you have
x = 0:0.1:pi;
y = sin(x);
you could use:
plot(x,y, '-b')
hold on
plot(x(10),y(10),'r*') % marking the 10th data point of x and y
hold on
plot(x(5),y(5),'r*') % marking the 5th data point of x and y
Similarly, you can plot more points using hold on and plot your break points.

Categories

Find more on 2-D and 3-D Plots 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!