I am not able to get a line to appear on my graph?

1 view (last 30 days)
clear all;
radius = 6378:50000; force = (3.986e5/(6378.^2));
figure plot(radius,force); axis([0 50e3 0 10]) xlabel('r(km)'); ylabel('F(m/s)');

Accepted Answer

Image Analyst
Image Analyst on 16 Sep 2018
You had force just as one single number, not a list of forces for each radius. Try this:
radius = 6378:50000;
force = 3.986e5 ./ (radius .^ 2);
figure
plot(radius,force, 'b-', 'LineWidth', 2);
% axis([0 50e3 0 10])
xlabel('r(km)');
ylabel('F(m/s)');
grid on;
title('force vs. radius', 'FontSize', 20);

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!