How to plot a graph based on user input???
Mostrar comentarios más antiguos
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 comentarios
Geoff Hayes
el 2 de Abr. de 2018
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
el 2 de Abr. de 2018
Walter Roberson
el 2 de Abr. de 2018
0.10 is the same number as 0.1. Ten of 0.1 is 1.0
Kingsley Bowoto
el 6 de Nov. de 2020
Its not working for me. Please can you give us what the inputs should look like.
Respuestas (0)
Categorías
Más información sobre Graphics Object Properties en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!