How to plot a graph based on user input???
조회 수: 8 (최근 30일)
이전 댓글 표시
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
Kingsley Bowoto
2020년 11월 6일
Its not working for me. Please can you give us what the inputs should look like.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!