# Message Boards

Posted 2 years ago
3139 Views
|
5 Replies
|
0 Total Likes
|
 Hello, I am new to Mathematica software and I am having problem to start my coding in Mathematica. to be honest, a bit clueless, I want to do simulation for fluorescence lifetime measurement. Here is my equation, Here, ? is the initial fluorescence intensity emitted by the sample when irradiated by laser pulses; ? is the fluorescence lifetime; ? denotes the repetition angular frequency of the short-pulsed laser; T is the period of pulse repetition (T = 2?/?); ? is the phase difference between the excitation pulse sequence and reference signal of the lock-in amplifier. Three phase-difference values of 0, ?/4, and ?/2 were considered. Next, I want to do where multiple fluorescence lifetime is used. Can anyone help me how to do simulation for equation 1 and equation 2? Thank you very much!
5 Replies
Sort By:
Posted 2 years ago
 Do these do what you want? i[tau_,phi_]:=Integrate[alpha E^(-t/tau)Cos[omega t+phi],{t,0,T}]; i[1,0] i[2,Pi/4] and i[tau1_,tau2_,phi_]:=Integrate[(alpha1 E^(-t/tau1)+alpha2 E^(-t/tau2))Cos[omega t+phi],{t,0,T}] i[1,2,0] i[1/2,1,Pi/2] 
Posted 2 years ago
 thank you so much for replying my question. may i know what is the i[1,0] i[2,Pi/4] for?
Posted 2 years ago
 I apologize if I misunderstood or wasn't clear.In each of those the first line defines a function to do your integration and the second and third lines show example usage.Asking Mathematica to evaluate this i[tau_,phi_]:=Integrate[alpha E^(-t/tau)Cos[omega t+phi],{t,0,T}]; i[1,0] then it will perform your integration with those two parameter values and should immediately display this (alpha*(E^T - Cos[omega*T] + omega*Sin[omega*T]))/(E^T*(1 + omega^2)) Likewise asking Mathematica to evaluate i[tau1_,tau2_,phi_]:=Integrate[(alpha1 E^(-t/tau1)+alpha2 E^(-t/tau2))Cos[omega t+phi],{t,0,T}]; i[1/2,1,Pi/2] will perform your integration with those three parameter values and should immediately display ((alpha2*E^T*(-(E^T*omega) + omega*Cos[omega*T] + Sin[omega*T]))/(1 + omega^2) + (alpha1*(-(E^(2*T)*omega) + omega*Cos[omega*T] + 2*Sin[omega*T]))/(4 + omega^2))/E^(2*T) If I still don't have this correct then please let me know and we will try to resolve this.
 A few comments.If you define and evaluate i[tau_,phi_]:=Integrate[alpha E^(-t/tau)Cos[2*pi*freq*t*phi),{t,0,T}] then Mathematica will remember that until you define something it to be something different or until you exit Mathematica. That means you do not need to type that line again.Defining a constant, like freq=80000000 will be remembered the same way until you change it or exit Mathematica.The symbol Pi in Mathematica is exactly the value of pi.If you put a ; at the end of a line it will calculate but not display the result.Then alpha=2; freq=80000000; i[tau_,phi_]:=Integrate[alpha E^(-t/tau)Cos[2*Pi*freq*t+phi],{t,0,T}]; integral=i[1,Pi/2]; Plot[integral,{T,0,6}] will calculate the integral and then plot the function of T.and Plot[integral,{T,0,6},PlotPoints->500] will do the same plot, but will calculate more points to produce a more detailed plot.Plot will not plot expressions that contain complex numbers, even if the value is very small, and will not plot expressions that have other variables which have not been assigned a value.Please see if this is sufficient to help you get what you are looking for.