Matrix modification

Hi I have a 2048 by 2048 matrix from X (pixels), Y(Binning), and Z(Intensity)-2D data. I want to modify this matrix (X, Pixel only) with a quadratic equation (for instance, 0.002*x^2-0.4*x+940) where x represents row number for rows (e.g. 300 to 500). The resultant matrix should be able to provide an image. Does anyone have idea or code to solve such type of problem in Igor? Will much appreciate the help.

It's not clear to me exactly what you are trying to accomplish. Do you want to distort the x-axis of an existing image so that NewX=0.002*OldX^2-0.4*OldX+940 or do you just want to create the image z=0.002*x^2-0.4*x+940?

If you are just trying to creating an image from an equation this little bit of code can get you started. Three windows are created on top of each other with three different images.

Function Test()

    Make/O/N=(2048, 2048) TestImage1=0, TestImage2=0, TestImage3=0
   
    TestImage1[][]=0.002*p^2-0.4*p+940
    TestImage2[][]=0.002*p^2-0.4*q+940
    TestImage3[300, 500][]=0.002*p^2-0.4*q+940
   
    DoWindow/K TestImageWindow1
    Display/N=TestImageWindow1;AppendImage TestImage1
    ModifyImage '' ctab= {*,*,ColdWarm,0}

    DoWindow/K TestImageWindow2
    Display/N=TestImageWindow2;AppendImage TestImage2
    ModifyImage '' ctab= {*,*,ColdWarm,0}

    DoWindow/K TestImageWindow3
    Display/N=TestImageWindow3;AppendImage TestImage3
    ModifyImage '' ctab= {*,*,ColdWarm,0}
end
Thanks Olelytken for your reply.

I want to distort the x-axis of an existing image so that NewX=0.002*OldX^2-0.4*OldX+940. The Y and Z should remain the same.
If you just want to display the image with the distorted x-axis you could plot the image using x- and y-waves, but if you want to continue working with the matrix you probably want to convert it to an evenly-spaced waveform format. You can do that with ImageInterpolate. I think there are several other options, but ImageInterpolate is the one I have previously used.

Function Test()
    Make/O/N=(2048, 2048) TestImage1=0
    Make/O/N=2049 XWave1, YWave1    // The x- and y-waves indicates the corners of the pixels and is therefore one point larger than the image
   
    TestImage1[][]=sin(8*pi/2048*p)

    XWave1[]=p-0.5
    YWave1[]=p-0.5
   
    XWave1[]=0.002*p^2+0.4*p+940   // Has to be monotonically increasing or decreasing. I changed -0.4*p to +0.4*p to ensure that
   
    DoWindow/K TestImageWindow1
    Display/N=TestImageWindow1; AppendImage TestImage1 vs {XWave1, YWave1}



    //  Converts the image to waveform
    Variable XStart=2000,XStep=1,XEnd=9000,YStart=500,YStep=1,YEnd=1500
    ImageInterpolate /DEST=TestImage2 /S={XStart,XStep,XEnd,YStart,YStep,YEnd} /W={XWave1, YWave1} XYWaves TestImage1
   
    //  Sets the x and y scaling of the new wave
    SetScale/P x, XStart, XStep, "", TestImage2
    SetScale/P y, YStart, YStep, "", TestImage2
   
    DoWindow/K TestImageWindow2
    Display/N=TestImageWindow2; AppendImage TestImage2
end


Thanks a lot olelytken. You are right. I think displaying the image with the distorted x-axis, plotting the image using x- and y-waves would be better instead of working with matrix. If you don't mind posting for this as well, would highly appreciate.
The first half of my example show how to plot an image using x- and y-waves. Here it is again:

Function Test()
    Make/O/N=(2048, 2048) TestImage1=0
    Make/O/N=2049 XWave1, YWave1    // The x- and y-waves indicates the corners of the pixels and is therefore one point larger than the image
 
    TestImage1[][]=sin(8*pi/2048*p)
 
    XWave1[]=p-0.5
    YWave1[]=p-0.5
 
    XWave1[]=0.002*p^2+0.4*p+940   // Has to be monotonically increasing or decreasing. I changed -0.4*p to +0.4*p to ensure that
 
    DoWindow/K TestImageWindow1
    Display/N=TestImageWindow1; AppendImage TestImage1 vs {XWave1, YWave1}
end


The AppendImage TestImage1 vs {XWave1, YWave1} line is the important one. You can try AppendImage TestImage1 instead to compare the effect of the x- and y-waves.
Thanks Ole for your kind reply.
I tried both of the codes in my system. I am having trouble getting the result I wanted.