i have this data from a text file that i want to plot like the supplied image, can anyone help me please?
here is the code i used to graph the picture shown
fidi = fopen('carpos2.txt','rt');
Dc = textscan(fidi, '%f%f%f%*f', 'CollectOutput',1);
fclose(fidi);
D = cell2mat(Dc);
ExptVct = unique(D(:,1));
RowLim = floor(size(D,1)/numel(ExptVct))*numel(ExptVct);
D = D(1:RowLim,:);
Dr = reshape(fidi = fopen('carpos2.txt','rt');
Dc = textscan(fidi, '%f%f%f%*f', 'CollectOutput',1);
fclose(fidi);
D = cell2mat(Dc);
ExptVct = unique(D(:,1));
RowLim = floor(size(D,1)/numel(ExptVct))*numel(ExptVct);
D = D(1:RowLim,:);
Dr = reshape(D, numel(ExptVct), [], 3);
figure
hold all
for k1 = 1:size(Dr,1)
plot(squeeze(Dr(k1,:,2)), squeeze(Dr(k1,:,3)))
end
hold off
grid
xlabel('Simulation Time (s)')
ylabel('velocity (m/s)')
%%title('Car ')
%%legend(compose('%2d',ExptVct), 'Location','NW')D, numel(ExptVct), [], 3);
figure
hold all
for k1 = 1:size(Dr,1)
plot(squeeze(Dr(k1,:,2)), squeeze(Dr(k1,:,3)))
end
hold off
grid
xlabel('Simulation Time (s)')
ylabel('velocity (m/s)')
%%title('Car ')
%%legend(compose('%2d',ExptVct), 'Location','NW')