# changing Xscale in 2D wave to nonlinear fomat

Wed, 06/12/2019 - 02:24 am

Hello,

I am getting the hang of Igor Pro but the task that I am trying to rescale a wave that is way out of the scope of my mathematic ability. I essentially want to change the delta of the rows to start at -0.4, peak at 1 and then go back down and end at -0.4, with increments of 0.02 (based on delta pattern from another wave in my data). This is essentially a symmetric triangle wave and from what Ive read online it involves some sort of fourier transformation formula with cos or sinc. I have very poor math skills and therefore have a lot of trouble coming up with the right formula. Can anyone help me out? I hope I was clear, if not please let me know so I can elaborate.

make /O /N=(140,12) TestWave=enoise(2,1)

SetScale /P y, 0, 0.1, TestWave

SetScale /P x, -0.4, 0.02, TestWave //I know this is not correct but I want increments to go: -0.4-->1-->-0.4

NewWaterFall TestWave //to visualize dimension scaling only

end

Thanks in advance for any suggestions!

Wave scaling must be monotonic and uniformly spaced. You will need to use a second wave whose values hold the scaling; this wave can be used for creating plots or doing calculations.

If this doesn't address your question, please elaborate.

June 12, 2019 at 06:06 am - Permalink

@jtigor, thanks for your suggestion. I thought about that as well but I want to ideally use the matrix for an image plot. When producing an image plot (Windows-->New--> ImagePlot), the dialog would only allow me to choose a Z wave and only had the calculated option for x and y waves. Do you know how to get around this?

June 12, 2019 at 07:03 am - Permalink

I am not sure I follow your variation of delta but let's take it step by step:

1. Create a DP output image of NxM points:

Make/N=(N,M)/D myImage

2. write an interpolation function:

myImage=myInterpolationFunction(p,q,srcImage)

3. The interpolation function itself would look something like this:

Variable pp,qq

Wave srcImage

Variable xx=myNonLinearFunction(pp)

Variable yy=myNonLinearFunction(qq)

return interp2D(srcImage,xx,yy)

End

Clearly you will have to code your delta and offset in the non-linear functions.

I hope this helps,

A.G.

June 12, 2019 at 07:50 am - Permalink