How can I add an unevenly spaced data set to a translated version of itself?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Star Strider
el 19 de Feb. de 2016
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 comentarios
Star Strider
el 19 de Feb. de 2016
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
el 20 de Feb. de 2016
Maybe use "sparse()"? I haven't used it (never needed to) so I can't help you further.
0 comentarios
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!