07-04-2012 09:56 AM
Hi!
I'm using AmpPhaseSpectrum and i was wondering how it works and what i can get from it.
For example, I use SinePattern to create a sine : SinePattern(nb_pts,5,ph1,sine1)
Then if I compute the spectrum what shall i get in the phase chart of AmpPhaseSpectrum?
Knowing that SinePattern computes the sine this way (according to the help browser of LabWindows):
amp*sin(2*pi*i*cycles/nb_pts+pi*phase/180).
Shall I get "phase"? "pi*phase/180"? or "2*pi*i*cycles/nb_pts+pi*phase/180"?
Thanks in advance
_tren_
07-05-2012 09:05 AM
Moreover, if i take amp[k] and ph[k] from the AmpPhaseSpectrum and use the mto generate sinepattern(nb_pts,amp[k],ph[k],k,tab), wouil I have something? Because I've tried this method but nothing appears on the graph when I want to plot tab...
Ideas?
If you want the code I can post it.
Thanks!
07-05-2012 09:35 AM
Ok, I finally post the code. In case of...
void Afficher_Reconstruction(double sig[], double amp[],double ph[])
{
int nb_ele, k,i,j;
double **tab,sine[nb_pts]={0};
nb_ele=sizeof(amp)/sizeof(amp[0]);
tab=malloc(nb_ele*sizeof(double));
for(k=0;k<nb_ele;k++)
{
tab[k]=malloc(nb_pts*sizeof(double));
for(j=0;j<nb_pts;j++)
{
tab[k][j]=0.0;
}
}
for(k=0;k<nb_ele;k++)
{
for(i=0;i<nb_pts;i++)
{
SinePattern (nb_pts, amp[k], ph[k], k, tab[k]);
//SineWave (nb_pts, amp[k],k*1.0/nb_pts, &ph[k], tab[k]);
sine[i]=sine[i]+tab[k][i];
}
}
PlotWaveform (p_rec, recpanel_graphrecon, sine, nb_pts, VAL_DOUBLE, 1.0, 0.0, 0.0, 1, VAL_THIN_LINE,VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED);
free(tab);
}
07-05-2012 10:55 AM - edited 07-05-2012 11:00 AM
Hi,
Thank you for posting your question on National Instruments' Forums.
I'm not sure I really understand what your question is.
What do you want to obtain in the end ? a reconstruction of your initial sine wave using the parameters you get from the AmpPhaseSpectrum function ?
Could you elaborate a little on your issue so that I would be able to help you ?
You can write in french if needed.
Best regards,
Guillaume H.
National Instruments France
07-06-2012 04:38 AM
Bonjour,
C'est exactement ça je souhaite calculer le spectre de phase grâce à AmpPhaseSpectrum et donc récuperer deux tableaux : un d'amplitude et un de phase.
Et le problème est : comment faire pour recréer le sinus initial grâce à ces deux tableaux. Le but étant de faire une décomposition harmonique de sgnaux plus complexes et de poouvoir ensuite reconstruire chaque harmonique et en faire la somme pour retoruver le signal originel.
D'où la question : peut-on écrire SinePattern(nb_pts,amp[k],ph[k],k,sine) pour reconstruire le kième harmonique.
Merci,
_trent_
07-09-2012 04:15 AM
Une petite relance du post
07-10-2012 07:19 AM
Du coup non? personne ne sait?