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!
0 个评论
回答(2 个)
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 个评论
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
2016-2-20
Maybe use "sparse()"? I haven't used it (never needed to) so I can't help you further.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Manage System Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!