?? fftdrawingdlg.cpp
字號:
pDC->Rectangle(rcClient);
int dx=rcClient.Width();
int dy=rcClient.Height();
double max=fabs(shuju[0]);
cishu=0;
int pp;
for( int p=0;p<N;p++)
{
if(fabs(shuju[p])>max)
{
max=fabs(shuju[p]);
pp=p;
}
}
if(max>(dy/2-10))
{
fuhao=-1;
while(max>(dy/2-10))
{
max=max/2;
cishu++;
}
for( p=0;p<N;p++)
{
for( int j=0;j<cishu;j++)
shuju[p]=shuju[p]/2;
}
}
else if(max<(dy/4-5))
{
fuhao=1;
while(max<(dy/4-5))
{
max=max*2;
cishu++;
}
for( p=0;p<N;p++)
{
for( int j=0;j<cishu;j++)
shuju[p]=shuju[p]*2;
}
}
else
fuhao=0;
//for(p=0;p<N;p++)
// if(fabs(shuju[p])>max)
// maxzhi=shuju[p];
// max=fabs(shuju[0]);
for( p=0;p<N;p++)
if(fabs(shuju[p])==max)
maxzhi=shuju[p];
//////////////以上是將數據處理成能在顯示區域顯示的值
}
Invalidate();
}
void CFftDrawingDlg::OnXubu()
{
// TODO: Add your control notification handler code here
if(b_shuju!=1)
MessageBox ("請先倒入數據計算fft, 請點擊 ‘ 倒入數據 ’ !","提示" );
if(b_shuju==1)
{
shuomingwenzi=2;
for( int i=0;i<N;i++)
shuju[i]=xubu[i];
///////////////以下是將數據處理成能在顯示區域顯示的值
CWnd *pWnd = GetDlgItem(IDC_STATIC);
CDC *pDC = pWnd->GetDC();
CRect rcClient;
pWnd->GetClientRect(rcClient);
pDC->Rectangle(rcClient);
int dx=rcClient.Width();
int dy=rcClient.Height();
double max=fabs(shuju[0]);
cishu=0;
int pp;
for( int p=0;p<N;p++)
{
if(fabs(shuju[p])>max)
{
max=fabs(shuju[p]);
pp=p;
}
}
if(max>(dy/2-10))
{
fuhao=-1;
while(max>(dy/2-10))
{
max=max/2;
cishu++;
}
for( p=0;p<N;p++)
{
for( int j=0;j<cishu;j++)
shuju[p]=shuju[p]/2;
}
}
else if(max<(dy/4-5))
{
fuhao=1;
while(max<(dy/4-5))
{
max=max*2;
cishu++;
}
for( p=0;p<N;p++)
{
for( int j=0;j<cishu;j++)
shuju[p]=shuju[p]*2;
}
}
else
fuhao=0;
//max=fabs(shuju[0]);
//for( p=0;p<N;p++)
//{
// if(fabs(shuju[p])>max)
// {
// max=fabs(shuju[p]);
// maxzhi=shuju[p];
// }
//}
for( p=0;p<N;p++)
if(fabs(shuju[p])==max)
maxzhi=shuju[p];
//////////////以上是將數據處理成能在顯示區域顯示的值
}
Invalidate();
}
void CFftDrawingDlg::OnMo()
{
// TODO: Add your control notification handler code here
if(b_shuju!=1)
MessageBox ("請先倒入數據計算fft,請點擊 ‘ 倒入數據 ’ !","提示" );
if(b_shuju==1)
{
shuomingwenzi=3;
for( int i=0;i<N;i++)
shuju[i]=sqrt(shibu[i]*shibu[i]+xubu[i]*xubu[i]);
///////////////以下是將數據處理成能在顯示區域顯示的值
CWnd *pWnd = GetDlgItem(IDC_STATIC);
CDC *pDC = pWnd->GetDC();
CRect rcClient;
pWnd->GetClientRect(rcClient);
pDC->Rectangle(rcClient);
int dx=rcClient.Width();
int dy=rcClient.Height();
double max=fabs(shuju[0]);
cishu=0;
int pp;
for(int p=0;p<N;p++)
{
if(fabs(shuju[p])>max)
{
max=fabs(shuju[p]);
pp=p;
}
}
if(max>(dy/2-10))
{
fuhao=-1;
while(max>(dy/2-10))
{
max=max/2;
cishu++;
}
for( p=0;p<N;p++)
{
for( int j=0;j<cishu;j++)
shuju[p]=shuju[p]/2;
}
}
else if(max<(dy/4-5))
{
fuhao=1;
while(max<(dy/4-5))
{
max=max*2;
cishu++;
}
for( p=0;p<N;p++)
{
for( int j=0;j<cishu;j++)
shuju[p]=shuju[p]*2;
}
}
else
fuhao=0;
//max=fabs(shuju[0]);
//for( p=0;p<N;p++)
//{
// if(fabs(shuju[p])>max)
// {
// max=fabs(shuju[p]);
// maxzhi=shuju[p];
// }
// }
for( p=0;p<N;p++)
if(fabs(shuju[p])==max)
maxzhi=shuju[p];
//////////////以上是將數據處理成能在顯示區域顯示的值
}
Invalidate();
}
void CFftDrawingDlg::OnXiangjiao()
{
// TODO: Add your control notification handler code here
if(b_shuju!=1)
MessageBox ("請先倒入數據計算fft,請點擊‘ 倒入數據 ’ !","提示" );
if(b_shuju==1)
{
shuomingwenzi=4;
for( int i=0;i<N;i++)
shuju[i]=atan(xubu[i]/shibu[i]); /////XI[i]/XR[i]
///////////////以下是將數據處理成能在顯示區域顯示的值
CWnd *pWnd = GetDlgItem(IDC_STATIC);
CDC *pDC = pWnd->GetDC();
CRect rcClient;
pWnd->GetClientRect(rcClient);
pDC->Rectangle(rcClient);
int dx=rcClient.Width();
int dy=rcClient.Height();
double max=fabs(shuju[0]);
cishu=0;
int pp;
for( int p=0;p<N;p++)
{
if(fabs(shuju[p])>max)
{
max=fabs(shuju[p]);
pp=p;
}
}
if(max>(dy/2-10))
{
fuhao=-1;
while(max>(dy/2-10))
{
max=max/2;
cishu++;
}
for( p=0;p<N;p++)
{
for( int j=0;j<cishu;j++)
shuju[p]=shuju[p]/2;
}
}
else if(max<(dy/4-5))
{
fuhao=1;
while(max<(dy/4-5))
{
max=max*2;
cishu++;
}
for( p=0;p<N;p++)
{
for( int j=0;j<cishu;j++)
shuju[p]=shuju[p]*2;
}
}
else
fuhao=0;
//max=fabs(shuju[0]);
//for( p=0;p<N;p++)
//{
// if(fabs(shuju[p])>max)
// {
// max=fabs(shuju[p]);
// maxzhi=shuju[p];
// }
//}
for( p=0;p<N;p++)
if(fabs(shuju[p])==max)
maxzhi=shuju[p];
//////////////以上是將數據處理成能在顯示區域顯示的值
Invalidate();
}
}
void CFftDrawingDlg::OnGonglvpu()
{
// TODO: Add your control notification handler code here
if(b_shuju!=1)
MessageBox ("請先倒入數據計算fft,請點擊‘ 倒入數據 ’ !","提示" );
if(b_shuju==1)
{
shuomingwenzi=5;
for(int i=0;i<N;i++)
shuju[i]=(shibu[i]*shibu[i]+xubu[i]*xubu[i])/N*128;
///////////////以下是將數據處理成能在顯示區域顯示的值
CWnd *pWnd = GetDlgItem(IDC_STATIC);
CDC *pDC = pWnd->GetDC();
CRect rcClient;
pWnd->GetClientRect(rcClient);
pDC->Rectangle(rcClient);
int dx=rcClient.Width();
int dy=rcClient.Height();
double max=fabs(shuju[0]);
cishu=0;
int pp;
for( int p=0;p<N;p++)
{
if(fabs(shuju[p])>max)
{
max=fabs(shuju[p]);
pp=p;
}
}
if(max>(dy/2-10))
{
fuhao=-1;
while(max>(dy/2-10))
{
max=max/2;
cishu++;
}
for( p=0;p<N;p++)
{
for( int j=0;j<cishu;j++)
shuju[p]=shuju[p]/2;
}
}
else if(max<(dy/4-5))
{
fuhao=1;
while(max<(dy/4-5))
{
max=max*2;
cishu++;
}
for( p=0;p<N;p++)
{
for( int j=0;j<cishu;j++)
shuju[p]=shuju[p]*2;
}
}
else
fuhao=0;
//max=fabs(shuju[0]);
//for( p=0;p<N;p++)
//{
// if(fabs(shuju[p])>max)
// {
// max=fabs(shuju[p]);
// maxzhi=shuju[p];
// }
//}
for( p=0;p<N;p++)
if(fabs(shuju[p])==max)
maxzhi=shuju[p];
//////////////以上是將數據處理成能在顯示區域顯示的值
}
Invalidate();
}
CScrollBar* CFftDrawingDlg::GetScrollBarCtrl(int nBar) const
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::GetScrollBarCtrl(nBar);
}
void CFftDrawingDlg::OnBnClickedIscaoed()
{
// TODO: Add your control notification handler code here
IDC_xiecao="fdsgdse";
Invalidate(1);
}
void CFftDrawingDlg::OnBnClickedCao()
{
// TODO: Add your control notification handler code here
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -