Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.