Hi,I got the code below which is to build how many peak I one based on the how many row I chose and I have attached the file for element to be put in multidimensional array and also the result I got:
% creating a multidimensional array
files = dir('*txt') ; % you are in the folder with text files
N = length(files) ;
names = {files(:).name}' ;
iwant = cell(N,1) ;
for i = 1:N
iwant{i} = importdata(files(i).name) ;
end
A = input('Please enter an element in form of iwant{i}:');
% find the number of samples
n = length (A(:,1));
% step change for the wavelength
step = 0.02;
% wavelength which is at the centre
p = A(:,1);
% to make new wavelength for each of wavelength in the samples
for j=1:n
new_wavelength(j,:) = p(j)-step*10:step:p(j)+step*10;
end
format shortG
j = input('Please input the row:');
i = input('Please input number for element:');
Delta_lambda=0.2;
int_fact= 0.00001.*iwant{i}(j,2);
denominator = Delta_lambda/2; % this is a constant
K=21; % the upper limit of the loop magic number
numerator = new_wavelength(j,11)-new_wavelength(j,1:K); % vectorize to have 21 elements
Peak_1(j,:) =(int_fact.*1./(1+(numerator/denominator).^2));
plot(new_wavelength(j,:).',Peak_1.','g')
But, it seem that all the peak is not connected. If possible could someone fix this problem? I been trying it for a few days but i kind of come to a death end. Hahaha. Thanks!

7 comentarios

Image Analyst
Image Analyst el 3 de Sept. de 2018
You forgot to tell us what to enter and forgot to attach a screenshot.
Mohamad Khairul Ikhwan Zulkarnain
Mohamad Khairul Ikhwan Zulkarnain el 3 de Sept. de 2018
I'll edit the post
Mohamad Khairul Ikhwan Zulkarnain
Mohamad Khairul Ikhwan Zulkarnain el 3 de Sept. de 2018
IF you want to choose the element choose it based on iwant{i} where i is any number 1-118
KALYAN ACHARJYA
KALYAN ACHARJYA el 4 de Sept. de 2018
Editada: KALYAN ACHARJYA el 4 de Sept. de 2018
Can you check here?
Mohamad Khairul Ikhwan Zulkarnain
Mohamad Khairul Ikhwan Zulkarnain el 4 de Sept. de 2018
Editada: Mohamad Khairul Ikhwan Zulkarnain el 4 de Sept. de 2018
Im not really sure which one is the answer. And from what I read it doesnt seem to be related bcs I have x-value and y-value but all the peak that I created is not connected. Can you tell me which one is the answer?
KSSV
KSSV el 4 de Sept. de 2018
Read about findpeaks
Mohamad Khairul Ikhwan Zulkarnain
Mohamad Khairul Ikhwan Zulkarnain el 4 de Sept. de 2018
Is it related to connecting all the data that i have to become on spectral line instead of separated vertical line?

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by