How to plot a graph based on user input???

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 件のコメント

Geoff Hayes
Geoff Hayes 2018 年 4 月 2 日
sonu - please provide an example of what you would enter for the inputs requested by your code. For example,
num = input('enter the interval to plot');
the statement is to "enter the interval to plot" so what does the user enter? An interval like [10 100]? Or something else?
sonu
sonu 2018 年 4 月 2 日
Hello, The user will enter interval as 0.1 to 0.10 or 0.01 to 0.0100,0.001 to 0.1000
That is of 1 to 10 minutes or seconds or milliseconds
Walter Roberson
Walter Roberson 2018 年 4 月 2 日
0.10 is the same number as 0.1. Ten of 0.1 is 1.0
Kingsley Bowoto
Kingsley Bowoto 2020 年 11 月 6 日
Its not working for me. Please can you give us what the inputs should look like.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraphics Object Properties についてさらに検索

タグ

質問済み:

2018 年 4 月 2 日

コメント済み:

2020 年 11 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by