How to plot a graph based on user input???
6 views (last 30 days)
Show older comments
Hello, kindly help me to solve this issue..I want to plot a graph based on interval which is given by
user
%%%%my code %%%
AA = input('enter the value of speed'); %%as of meter/second
speed = AA*3.6 %%convert into km/hr
speed_0 = speed/60; %%calc for minute
speed_1 = speed/3600; %%calc for second
speed_2 = speed_1/1000; %%calc for Millisecond
sortiedate = [2018,03,23]
b = input('enter the range');
num = input('enter the interval to plot');
pp =round(log10(num));
if pp == -1
ms =1/(24*60)
end
if pp == -1
for bb =1:5
t(bb) = sqrt((speed_0*bb).^2 +(b.^2));
end
dd = fliplr(t);
dd_1 = b;
dd_2 = t;
ee = [dd,dd_1,dd_2];
time_1 = (0:1:10)
abc = length(ee)
stime = datenum(2018,03,23,10,00,00)
endtime = datenum(2018,03,23,10,10,00)
ms = 1/(24*60)
tme = stime:ms:etime
tme_1 = datevec(tme)
datetime = [(tme_1)]
time_s = datenum (double(datetime));
figure
title ('range vs time')
xlabel('time_s (minutes)')
ylabel('range (km)')
hold on;
grid minor
plot(time_s,ee,'r.-')
legend('range vs time')
DynamicDateTicks();
end
I know I have to pass the variable 'num' in plot function,but I am not getting a correct answer.
Instead of changing in interval,range (yaxis) values are getting changed.
4 Comments
Kingsley Bowoto
on 6 Nov 2020
Its not working for me. Please can you give us what the inputs should look like.
Answers (0)
See Also
Categories
Find more on Graphics Object Properties 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!