| Thread Closed |
So I have another matlab problem... |
Share Thread | Thread Tools |
| Apr4-07, 09:07 AM | #1 |
|
|
So I have another matlab problem...
Should be a simple one, just can't get it to work. Basically, I have two sets of data that I want to compare. One set of data was observed at set intervals of time, and the second set of data is calculated - the problem is that the theoretical data has entries for non-integer values of t - when the observed is in single integer steps.
This means that for the period of a minute in the theoretical data, I'll have several values but only a single observed value. Unfortunately, the number of theoretical values in a given range differs throughout so I feel that the best way to sort this out would be to lose a bit of accuracy and plot the observed data then somehow automatically calculate a point for each bit in time which would correspond to my theoretical. Is this possible? |
| Apr4-07, 03:07 PM | #2 |
|
|
Plot both data sets and compare them or alternatively using the theoretical model, calculate the values given the experimental t's then plot and compare.
|
| Apr4-07, 05:38 PM | #3 |
|
|
I would calculate the experimental t's, but the theoretical data is calculated in an ODE solver with a defined tolerance (as far as I know, theres no way to define a definite step in ODE solvers, only an initial suggestion?). Leaves me with plotting the two results, is there any way to subtract two plots? Just to give a nicer comparison.
|
| Apr4-07, 05:59 PM | #4 |
|
|
So I have another matlab problem...
Take the experimental output and the theoretical output and do a term by term search for the coincident times and subtract them.
I'd just plot both then make the comparision, it'd look better to me and more professional. |
| Apr4-07, 09:00 PM | #5 |
|
|
If you're using Matlab's ODE solver you can give it the time values at which you want the solution. Also, you can use the interp functions to interpolate your solution down to the coarser time grid.
|
| Apr4-07, 09:09 PM | #6 |
|
|
Very true......Forgot about those functions. |
| Apr5-07, 03:03 AM | #7 |
|
|
|
| Apr5-07, 06:27 AM | #8 |
|
|
It seems to me a bit dangerous interpolating the experimental data -- eg. the theoretical data could show much higher frequency dynamics than the experimental data.
In which case, I would average out the theoretical data according to the time scale of the device used to measure the experimental stuff. |
| Apr5-07, 08:55 AM | #9 |
|
|
tspan = [t0, tf] where t0 is the starting time and tf is the final time, just change it to tspan = [t0, t1, t2, t3, t4, tf] where t0,t1,t2,... are the points you want the solution at. And no, it does not affect the accuracy of the integration scheme, the ode solver solves it at many more points but only returns values for the specified points. |
| Apr8-07, 09:44 AM | #10 |
|
|
excellent. Very much appreciated LeBrad.
|
| Thread Closed |
| Thread Tools | |
Similar Threads for: So I have another matlab problem...
|
||||
| Thread | Forum | Replies | ||
| matlab problem | Math & Science Software | 1 | ||
| Another Matlab Problem | Math & Science Software | 2 | ||
| MATLab Problem | Math & Science Software | 3 | ||
| Matlab problem about AM and FM | Math & Science Software | 1 | ||
| Another Matlab problem | Math & Science Software | 4 | ||