Question: discretize function into matlab array

Hello,

If I have a function:

f(x):=x^2:

And I want

The array: f(x-y) for all x & y  from 0 to 2 with stepsize 0.5

in the same format that matlab stores saved arrays (in a .mat file), is that possible ??

Basically, I would like to be able to open matlab and load an array called 'f' 'from a file generated from maple, such that when I'm in my matlab workspase and type:

f

I get:

f =

         0         0.2500    1.0000    2.2500    4.0000
    0.2500         0         0.2500    1.0000    2.2500
    1.0000    0.2500         0         0.2500    1.0000
    2.2500    1.0000    0.2500         0         0.2500
    4.0000    2.2500    1.0000    0.2500         0

 

Which is a discretized version of the funciton f(x-y), where f(x)=x^2 , and x runs along the horizontal axis from 0 to 2 with step size 0.5, and y runs along the vertical axis from 0 to 2 with step size 0.5.

--------------------------------

Any help, suggestions or discussion would be greatly appreciated

Thanks!

 

 

Please Wait...