
Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
how can i plot the following text files?
조회 수: 1 (최근 30일)
이전 댓글 표시
im trying to plot the textfiles attached like the image attached, can anyone help me please?

댓글 수: 0
답변 (3개)
Sajeer Modavan
2019년 3월 16일
Input1 = load('double_lane_velocity_lane1.txt');
Input2 = load('double_lane_velocity_lane2.txt');
figure
for ii = 0:49
index1 = find(Input1(:,1)==ii);
index2 = find(Input2(:,1)==ii);
t = [Input1(index1,2); Input2(index2,2)];
In = [Input1(index1,3); Input2(index2,3)];
plot(t,In),hold on
end
ylim([18 41])
xlabel('Simulation Time (s)')
ylabel('velocity (m/s)')

댓글 수: 0
Sajeer Modavan
2019년 3월 17일
편집: Sajeer Modavan
2019년 3월 17일
For plotting combined input 1 and 2
clear, clc, close all;
Input1 = load('double_lane_position_lane12k.txt');
Input2 = load('double_lane_position_lane22k.txt');
fig = figure;
for ii = 0:49
index1 = find(Input1(:,1)==ii);
index2 = find(Input2(:,1)==ii);
t = [Input1(index1,2); Input2(index2,2)];
In = [Input1(index1,3); Input2(index2,3)];
plot(t,In),hold on
end
xlabel('Simulation Time (s)')
ylabel('velocity (m/s)')

you can edith this code for plotting input 1 and 2 seperate
댓글 수: 1
Sajeer Modavan
2019년 3월 24일
Do you need any further help, accept the answer and close this issue if you don't need any further help.
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!