LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about how AmpPhaseSpectrum works

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_

0 Kudos
Message 1 of 7
(4,247 Views)

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!

0 Kudos
Message 2 of 7
(4,237 Views)

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);
}

 

0 Kudos
Message 3 of 7
(4,234 Views)

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

0 Kudos
Message 4 of 7
(4,232 Views)

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_

0 Kudos
Message 5 of 7
(4,224 Views)

Une petite relance du post 

0 Kudos
Message 6 of 7
(4,213 Views)

Du coup non? personne ne sait?

0 Kudos
Message 7 of 7
(4,201 Views)