2D mapping with datapoints from serpent movement.

2 Ansichten (letzte 30 Tage)
NOOR HIDAYAT ABU BAKAR
NOOR HIDAYAT ABU BAKAR am 22 Jun. 2020
Kommentiert: KSSV am 23 Jun. 2020
Hi everyone,
Does anyone know how to create a 2D mapping from 9000 datapoints of 150 minutes running time with the movement left to right then go down right to left (total has 7 loops). I able to created the 2D mapping but the I'm not sure I arranged it wrongly. Since I'm totally noob about matlab, I do hope someone can could help me on this. hereby I written the script.
%size of matrix
intensity_size = 15;
%Update the file location as per need
fileID = fopen('C:\95.txt', 'r');
formatSpec = '%f %f %f';
size_data = [3 Inf];
%Read MS data 3 columns
raw_data = fscanf(fileID, formatSpec, size_data);
fclose(fileID);
%Transform the matrix to look like original text file
raw_data = raw_data';
%Find datapoints per pixel; should be 40 datapoints for each second data
datapoints = size(raw_data, 1)/intensity_size^2;
%Use only the intensity column of raw MS data
raw_data = raw_data(:,2);
%Average the value for every 20 sec datapoints
intensity = mean(reshape(raw_data, datapoints/2, []));
%Skip the blank 20 sec sampling datapoints mean intensity
intensity = intensity(2:2:end);
%Reshape to nxn matrix
intensity = reshape(intensity, intensity_size, []);
%Transform to get the actual average intensity for 1mm 20 sec sample data
intensity = intensity';
I just need the mapping it accordingly to the serpent movement. Most of the plotted map were wrong. Thank in advance!

Antworten (1)

darova
darova am 23 Jun. 2020
try this
x = [0 repmat([5 5 0 0],1,10)];
y = [1:20;1:20];
y = [y(:)' y(end)];
plot(x,y)
axis([-1 6 -1 22])

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by