How can I add an unevenly spaced data set to a translated version of itself?

3 次查看(过去 30 天)
I have some unevenly spaced data (Temperature vs time) which is the output of lengthy simulations.
I have the temperature vs. time curve for a single laser pulse hitting my system, and I want the temperature vs. time curve for multiple laser pulses (with some delay between pulses) hitting my system.
This multiple pulse temperature curve is just the sum of several single pulse temperature cases, just starting at different times. e.g. if my single pulse was T=exp(-t) then the multiple pulse case would be:
T=exp(-t)+exp(-(t-t_1))+exp(-(t-2*t_1))+exp(-(t-3*t_1))... and so on, with each exponential representing one pulse.
So, I need to add the data to itself, with a phase shift.
For example, if my data was y=cos(x) then I need to be able to generate the curve y=cos(x)+cos(x-phi); Now I have tried using interp1(Temperature,time,newtimeinterval) to try and make my data evenly spaced, thus making the above problem trivial.
However, this results in an enormous vector that MATLAB's memory cannot handle. My data ranges from being spaced picoseconds apart to entire tenths of a second, this was done in the interest of simulation speed.
So, is there some way to add unevenly spaced data to a phase shift of itself without using the interp1 function to make it evenly spaced? I've tried numerous clever ways to interpolate at only select points so that MATLAB doesn't run out of memory but I keep having indexing issues or something or the other comes up. I just wanted to make sure there weren't any obvious and efficient methods that I was missing.
Thanks in advance!

回答(2 个)

Star Strider
Star Strider 2016-2-19
The interp1 function would be my approach. Consider how much time resolution you actually need, and then interpolate to a much coarser time scale than picoseconds. I would use the longest time interval in your simulation as the sampling interval, and then interpolate using a time vector based on that sampling interval.
  2 个评论
Pratik Samant
Pratik Samant 2016-2-19
This is not a bad idea, this is currently my backup plan. The problem is primarily that the laser duration is only 5ps and so we struggle quite a bit in order to be able to capture all the temperature rise characteristics (which primarily occur during the excitation).
Thanks for the suggestion though! The curve generated with interp1 doesn't look half bad so hey it won't be the end of the world if I have to resort to it. :)
Star Strider
Star Strider 2016-2-19
My pleasure.
The problem with unevenly sampled data is that doing any sort of signal processing on it it essentially impossible, and any sort of finer data interpolation than your longest sampling interval runs the risk of creating data where none actually exist.
If you’re doing the same experiment or simulation repeatedly, another option would be to do an ensemble average of the individual pulses (if that is possible, given your experimental conditions), then do the processing on the ensemble average. That would give you a shorter total time, and you wouldn’t have to sacrifice any time resolution or lose any data.

请先登录,再进行评论。


Image Analyst
Image Analyst 2016-2-20
Maybe use "sparse()"? I haven't used it (never needed to) so I can't help you further.

类别

Help CenterFile Exchange 中查找有关 Manage System Data 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by