how add data continuous in a for loop - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

how add data continuous in a for loop

zak9000zak9000 Posts: 2Member
hi guys
my code is shown below. frist i read data from a excel file. the i have a for loop to read 11 rows from the excel. I do some calculations next. when i run this file i obtain a series absorption profiles overlapped to each other due to the hold on function plotted. what i would like to do is some how continuously add the absorption data called absorbance such that in the end all absorption data are added together and i able to see on the plot the summation of all the absorption data. please help!

function simulate = absorptionprofile

linecenter=xlsread('selection.xlsx','C:C');

linestrength=xlsread('selection.xlsx','E:E');

gammair=xlsread('selection.xlsx','G:G');

gammaself=xlsread('selection.xlsx','H:H');

linewidth=0.9852*gammair+gammaself*0.0148;

for k=340:349
v=6765:0.01:7230;
x=(v-linecenter(k))/linewidth(k);
lineshape=(1./(pi*linewidth(k))).*(1./(1+x.^2));
absorbance=linestrength(k).*lineshape
hold on
plot(x,absorbance)
end
Sign In or Register to comment.