If you get the original function back after the reverse, you have probably coded the transform correctly.
The problem is likely to be that your sampling rate is not a multiple of the basic frequency of sin(0.1*x). This means that you get a large FFT component close to the frequency, but you also get "noise" throughout the range, due to the fact that the residues do not cancel out.
I would try taking an FFT of sin(x), sin(2*x), etc., and see if these functions give the expected values.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
Thank You for the hint. I have tried with sin(nx), sin(2pi*x/n) and sin(2pi*x*n) too, but results were similar.
The most promising result was for the option with sin(2pi*x*n): here is a result with n=10. Values for x>270 are 0.
I used decimation in frequency FFT instead of decimation in time version, but it still doesn't show good values.
The exp function is inside function called "Shift".
As I wrote earlier, I don't use complex numbers library, so there are both tables for real and imagery parts. I used this relation: exp(i*phi)=cos(phi)+i*sin(phi).
Hello, I do not want to use an MDI app to create new documents of the same kind, like in text processors. Instead I want to be able to open different child windows from the menu. The menu handling is clear. When I go and create a new form with controls in the resources/dialog editor, how can I connect them to what I see in the client area of the child ? The classic kind of business software, you know. A user can open a customer window, then a payment window, a child for envoices, for banking, statics and so on. Normal dialog windows do not fill the client area, they are on top of all. That is not what I am going for. Thank You.
Hello. I got it now. To occupy an SDI/MDI with a formview resource template there is one detail in the project assistant. At the last page one can fill in from what the view derives. The preset is CView, but you must change it to CFormView. That was all. Well, I would have liked to make it an existing project, but this is ok, too. Thank You.
In my MFC application, I am doing a custom drawing in my dialog class OnPaint(). I have also created a few controls in dialog template. I have also resized and repositioned some of the controls in the dialog code. When I run my application, the controls are flickering.
Please suggest me how to avoid this?
CDC *pDC = GetDC(); //Get DC for Dialog's Client Area
pDCTmp->CreateCompatibleDC(pDC); //Create Compatible DC(pDCTmp) for Dialog's Client Area(pDC)
//pDCTmp is a member Variable
pBgBitmap->CreateCompatibleBitmap (pDC, 800, 640 ); //Create Compatible Bitmap(pBgBitmap) for Dialog's Client Area(pDC)
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
rect = rScreen; //rScreen is Client rect
pDCTmp->FillRect(rect,&CBrush(RGB(152, 185, 192))); //pDCTmp member variable is used to draw
//Custom drawings using the pDCTmp
A seperate thread function created already which calls a function UpdateAllViews() as shown below every half a second which in turn calls Invalidate the CFP Dialog. This is done to continuously update some real time numerical values on the dialog. When I remove this line
then there is no flickering on the dialog. But the values are not updated. How to avoid this flickering without affecting the value updation.
I'm a little confused by some of your code but generally I think you will
have to override WM_ERASEBKGND so that the background is not erased by the
default processing. Do not call the base class; just return TRUE.
1. Do you have to call Invalidate() from a thread? Could you use a timer in the dialog
and only update what is needed instead of invalidating the whole dialog?
2. Are your dialog controls embedded in a TabControl/TabPage? If so you will have to
create a custom TabControl and TabPage to override the OnEraseBackground() in those and
paint the background in a temp dc as well.
3. I'm not sure about this, but you may have to set the dialog style WS_CLIBCHILDREN to
include them in the dialogs clip region. Look at definition in msdn.
That means it doesn't paint the background before it sends you an WM_PAINT
If you want/need to transparent overlay the bitmap you have to use a transparent colour to stop flashing
CPaintDC dc(this); // device context for painting
// transfer the bitmap into paint DC using a transparent color
10, 10, bmp.bmWidth, bmp.bmHeight, // destination coordinates and sizes
&pDCTmp, // source DC .. your DC with bitmap
0, 0, bmp.bmWidth, bmp.bmHeight, // source coordinates and sizes
RGB(255, 0, 0)); // transparent color
I'm generating dialog templates programmatically for a win32 project. A thing I often want to do is size the dialog box such that the distance between the left edge of the client region and the left edge of the leftmost control is the same as that between the right edge of the rightmost control and the right edge of the client region. Since the size of the dialog box as specified in the template, I believe, includes the non-client area, the only way I know of to do this is to use AdjustWindowRect on a RECT representing the desired client region. Since this requires the handle of the window being adjusted, I can't do it until after the dialog has been created. So I was wondering...if I can't ensure equal margins until runtime, how is it possible that one can use the GUI editor Visual Studio provides to create dialogs with equal margins ahead of time? I want to be able to do that too.
You can select a set of controls in the editor and then use the toolbar tool that centres the group in the dialog. There are tools to centre horizontally or vertically, make equidistant, align together etc.