COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Resampling/Interpolation issue

• Email
• Follow

Is it possible to resample data without having a rate multiplier composed of a rational ratio of two integers?  If I were to use the resample function in MATLAB, it asks for p and q to be integers.  I have looked at other interpolation and sampling functions and all of them at least ask for a rational number to multiple by the original rate.  In my case, I would like to multiply by a number calculated to an accuracy of 0.001.  If this was possible, I would be looking at an example p-value of 59.012 and a q-value of 1 for the resample function (which I know is not the required integer values but would result in a rational ratio for p/q).  Does anyone have suggestions for how I can deal with this unique case?

 0
Reply Sarah 7/20/2010 6:03:19 PM

See related articles to this posting


"Sarah " <semcmahon@jacks.sdstate.edu> wrote in message
news:i24od7$47i$1@fred.mathworks.com...
> Is it possible to resample data without having a rate multiplier composed
> of a rational ratio of two integers?  If I were to use the resample
> function in MATLAB, it asks for p and q to be integers.  I have looked at
> other interpolation and sampling functions and all of them at least ask
> for a rational number to multiple by the original rate.  In my case, I
> would like to multiply by a number calculated to an accuracy of 0.001.  If
> this was possible, I would be looking at an example p-value of 59.012 and
> a q-value of 1 for the resample function (which I know is not the required
> integer values but would result in a rational ratio for p/q).  Does anyone
> have suggestions for how I can deal with this unique case?

Use the RAT function to determine integer values for P and Q that satisfy

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/rat.html

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


 0
Reply slord (13686) 7/20/2010 7:19:42 PM

"Steven_Lord" <slord@mathworks.com> wrote in message <i24sse$pjh$1@fred.mathworks.com>...
>
>
> "Sarah " <semcmahon@jacks.sdstate.edu> wrote in message
> news:i24od7$47i$1@fred.mathworks.com...
> > Is it possible to resample data without having a rate multiplier composed
> > of a rational ratio of two integers?  If I were to use the resample
> > function in MATLAB, it asks for p and q to be integers.  I have looked at
> > other interpolation and sampling functions and all of them at least ask
> > for a rational number to multiple by the original rate.  In my case, I
> > would like to multiply by a number calculated to an accuracy of 0.001.  If
> > this was possible, I would be looking at an example p-value of 59.012 and
> > a q-value of 1 for the resample function (which I know is not the required
> > integer values but would result in a rational ratio for p/q).  Does anyone
> > have suggestions for how I can deal with this unique case?
>
> Use the RAT function to determine integer values for P and Q that satisfy
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/rat.html
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

>Steve,
Thank you for your reply.  I can see where your suggestion comes from, but I'm not sure it will help in my case.  My original sampling rate was used to determine where the signal frequency fell in the 59-61 Hz range.  To obtain the accuracy required by my application, I need to be able to resample at a rate that uses the calculated frequency which is estimated to the thousandth decimal place.  I fear that the rat function would just put me back to square one.  What I really need is to have a resampling function that isn't based off of an integer or integer ratio multiplication of the original sampling rate.
--Sarah

 0
Reply semcmahon (2) 7/20/2010 7:44:04 PM

"Sarah " <semcmahon@jacks.sdstate.edu> wrote in message <i24ua4$hc$1@fred.mathworks.com>...
> "Steven_Lord" <slord@mathworks.com> wrote in message <i24sse$pjh$1@fred.mathworks.com>...
> >
> >
> > "Sarah " <semcmahon@jacks.sdstate.edu> wrote in message
> > news:i24od7$47i$1@fred.mathworks.com...
> > > Is it possible to resample data without having a rate multiplier composed
> > > of a rational ratio of two integers?  If I were to use the resample
> > > function in MATLAB, it asks for p and q to be integers.  I have looked at
> > > other interpolation and sampling functions and all of them at least ask
> > > for a rational number to multiple by the original rate.  In my case, I
> > > would like to multiply by a number calculated to an accuracy of 0.001.  If
> > > this was possible, I would be looking at an example p-value of 59.012 and
> > > a q-value of 1 for the resample function (which I know is not the required
> > > integer values but would result in a rational ratio for p/q).  Does anyone
> > > have suggestions for how I can deal with this unique case?
> >
> > Use the RAT function to determine integer values for P and Q that satisfy
> > your tolerance.
> >
> > http://www.mathworks.com/access/helpdesk/help/techdoc/ref/rat.html
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> > To contact Technical Support use the Contact Us link on
> > http://www.mathworks.com
>
> >Steve,
> Thank you for your reply.  I can see where your suggestion comes from, but I'm not sure it will help in my case.  My original sampling rate was used to determine where the signal frequency fell in the 59-61 Hz range.  To obtain the accuracy required by my application, I need to be able to resample at a rate that uses the calculated frequency which is estimated to the thousandth decimal place.  I fear that the rat function would just put me back to square one.  What I really need is to have a resampling function that isn't based off of an integer or integer ratio multiplication of the original sampling rate.
> --Sarah

It looks like rat would do the trick if I didn't have to call it extrinsically in my Embedded MATLAB code.  Do you know of any other functions that would give similar results but wouldn't be extrinsic functions in SIMULINK's Embedded MATLAB block?
Thanks,
Sarah

 0
Reply semcmahon (2) 7/20/2010 8:42:04 PM

3 Replies
529 Views

Similar Articles

12/8/2013 5:38:27 PM
page loaded in 168625 ms. (0)

Similar Artilces:

LDAP issue.
I've recently noted that my LDAP interface is throwing an error with Sendmail. OpenLDAP seems to be speaking version 3 of LDAP, while Sendmail seems to be speaking version 2, and the LDAP server is rejecting the queries. What do I need to fix this situation? Is there something simple like a compile-time option I need to throw on either package so they will sync up witht he same version? D. Stussy wrote: > I've recently noted that my LDAP interface is throwing an error with > Sendmail. OpenLDAP seems to be speaking version 3 of LDAP, while Sendmail > seems to be speaking

Precision issue?
; stop > end > <rich@comp> 5% ./h > single precision y = 1110920. > <rich@comp> 6% > I know this is a form of under- > flow in a sense, but I really need a work around suggestion. > There are many, many lines of code involved here. One workaround that will mitigate, though not eliminate, the roundoff issue is to use an expression like j*yy instead of the intermediate sum y wherever it is needed. You can reduce (but not eliminate) the roundoff error even more with "real*8 yy"; just be sure to initialize it as yy=1.10d0, NOT yy... to itself. Hard to tell for sure from the simplified sample shown, but often there are other things going on in the same loop as the summation, with the summation itself a secondary issue. A prime example is something like solving a differential equation; in cases such as that, re-ordering the values is not likely to be even sensible. Paul's suggestion to substitute multiplication in place of addition is often (but not always) a good approach there. Hard to say without a bigger picture of the real application. -- Richard Maine | Good judgment comes from experience

Rewriting issue
Hi @all out there, unfortunately, I'm not a geek concering address rewriting. Perhaps anybody = of you as a good hint for me how to solve a little problem. I've got a test environment where all mails created by the application shou= ld be sent to a specific mailaccount ignoring the original recipient. To co= mply with this I created a rewrite rule in the sendmail.mc file looking lik= e this (I changed the real recipient) R$* < @$* > $#esmtp$@mailhost $: testmailbox < @ testmail . co= m > Result: All recipients are rewritten to "testmailbox@testmail.com Issue with variables Hi, I want to do some on many variables and I want to use a for iteration for that. In order to do thatm I use: for i=1:10 load(strcat('test#',int2str(i),'.txt')) maxi=max(strcat('test_',int2str(i))); mini=min(strcat('test_',int2str(i))); avg=mean(strcat('test_',int2str(i))); result(i)=[maxi(2:end)' mini(2:end)' avg(2:end)'] end the issue is that Matlab give my the max of strcat but not the max of the function associed to it. Do you have any clue for solving that? Thanks Stephane Stephane Besnard wrote: > Hi, I want to do some on many variables and I want to use a for iteration > for that. In order to do thatm I use: > > for i=1:10 > load(strcat('test#',int2str(i),'.txt')) > maxi=max(strcat('test_',int2str(i))); > mini=min(strcat('test_',int2str(i))); > avg=mean(strcat('test_',int2str(i))); > result(i)=[maxi(2:end)' mini(2:end)' avg(2:end)'] > end > > the issue is that Matlab give my the max of strcat but not the max of the > function associed to it. Do you have any clue for solving Script Issue Incomplete Search] > Preform Find[] > If [Nonconformance Notification::${RCA Cause and resolution complete checkbox} = "yes"] > Constrain Found Set [Restore] > // Omit Record > End if > // Preform Find [Restore] > Sort Records [Restore; No dialog] >// Else If ["LastMessageChoice= 2"] > // Exit Script [] >End If >Go to layout ["Manager Incomplete" (Nonconformance Notification)] >Show/Hide Status Area [Show] Thanks for any incite into this issue. Doug In article <4pKdnZm_QuA2ebnQnZ2dnUVZ_hGdnZ2d@giganews.com>... and resolution complete > > checkbox} = "yes"] > > Constrain Found Set [Restore] > > // Omit Record > > End if > > // Preform Find [Restore] > > Sort Records [Restore; No dialog] > >// Else If ["LastMessageChoice= 2"] > > // Exit Script [] > >End If > >Go to layout ["Manager Incomplete" (Nonconformance Notification)] > >Show/Hide Status Area [Show] > > > Thanks for any incite into this issue. > Doug In article <

Design issue
:pan.2004.05.23.08.23.18.156723@localhost.localdomain... > > Hi everyone, > > > > I have already started programming an application with the following > model: > > > > I have a class A and a class B. > > Where, > > class B extends Thread, receives data from an external source at > > undetermined intervals of time and interpretes this data. The first issue is that you should be implementing Runnable not extending Thread. It is rarely ever appropriate to extend Thread. > > Class A is a Swing GUI which has an object of class B. Class A has > to get > > data from class

Report issue
Hi there, I am working with a report whose recordsource is a query based off of a sql table. We are assigning the recordsource at runtime through code rather than the recordsource property of the report(We are using a SQL stored procedure to fill the table, the stored procedure is called through an ADO string). The problem is, whenever the table contains over 3000 records or so, the data does not display on the form(the report is about 140 pages or so). It takes about 4 minutes or so for the report to display, and the only thing on the report are "#Name?" and "#Error&quo

TeXForm issue
I run to the following problem in TeXForm. With: {TeXForm[(Sqrt[\[Rho]] + 1)^2]} I get: {\left(\sqrt{\r ho }+1\r ight)^2} Notice the extra space after the \r in \r ho and also in \r ight. These spaces persist when I copy/paste the output as text to my latex editor, and of course cause an error in typesetting. If I remove the curly braces around TeXForm, these white spaces go away. Do others see this? I am on "7.0 for Mac OS X x86 (64-bit) (November 11, 2008)", OS 10.6.5 Themis In Mathematica 8.0.0 under Windows, I'm not getting that break after either "r