How to graph normalized data?

4 次查看(过去 30 天)
Isha Punn
Isha Punn 2017-10-25
I have a data set with cell length and its light intensity at a given length. I normalized the cell length from 0-1, now how can I get the values of the light intensity at each normalized cell length? I have the data in an excel file where the actual cell length is in a column and the light intensities for 9 cells are in the rows. Any help would be appreciated where I can get the light intensities for the normalized cell length

回答(1 个)

Sunny Choudhary
Sunny Choudhary 2023-6-22
To get the values of light intensity at each normalized cell length, you can follow these steps:
1. Import the data from the Excel file into MATLAB using the readtable() function. For example:
data = readtable('data.xlsx');
2. Extract the actual cell length column and the light intensity data columns from the table. Assuming the table has the cell length data in the first column and the light intensities for 9 cells in the subsequent columns, you could extract the data as:
% Extract the cell length and light intensity data
cell_length = data{:,1}; % Assuming cell length is in the first column
intensity_data = data{:,2:end}; % Assuming light intensity data is in the subsequent columns
3. Normalize the cell length data from 0 to 1 using the mat2gray() function. For example:
% Extract the cell length and light intensity data
cell_length = data{:,1}; % Assuming cell length is in the first column
intensity_data = data{:,2:end}; % Assuming light intensity data is in the subsequent columns
4. Interpolate the light intensity data for each normalized cell length using the interp1() function. For example, to interpolate the light intensity data for a new set of normalized cell lengths (new_norm_lengths) based on the original intensity_data matrix, you could use:
normalized_cell_length = mat2gray(cell_length);
This will create a new matrix new_intensity_data with the interpolated light intensity values for each new normalized cell length.
Note: The interp1() function assumes the input data is sorted in ascending order; you may want to sort normalized_cell_length and intensity_data using sort() if they are not already sorted.

类别

Help CenterFile Exchange 中查找有关 Discrete Data Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by