cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.

Matrix as input

rtilak-disabled
1-Newbie

Matrix as input

I have a matrix of X (coordiates), Y (Coordinates) and Matrix Z.

Matrix Z is not a function of X and Y.

One to one mapping of matrix is required.

I need a new function whose inputs would be elements from matrix X and matrix Y and the result would be the same ith and jth element from Matrix Z.

11 REPLIES 11

On 4/30/2009 9:36:42 AM, rtilak wrote:
I have a matrix of X (coordiates), Y (Coordinates) and Matrix Z.

Matrix Z is not a function of X and Y.

One to one mapping of matrix is required.

I need a new function whose inputs would be elements from matrix X and matrix Y and the result would be the same ith and jth element from Matrix Z.


Try

getIJ(M,x,y,i,j):=Mxi,yj

getZij(i,j):=getIJ(Z,X,Y,i,j)

Does it work as suggested ?
If not, "Save as" 11 and attach a little bit of what you want.
Please don't be cheap in explaining

http://collab.mathsoft.com/~Mathcad2000/read?123642,63

jmG

On 4/30/2009 11:59:05 AM, jmG wrote:
>Does it work as suggested ?
>If not, "Save as" 11 and
>attach a little bit of what
>you want.
>Please don't be cheap in
>explaining
>
>http://collab.mathsoft.com/~Ma
>thcad2000/read?123642,63
>
>jmG

Its like this...

I had coordinates of x and y. I converted them
to natural coordinates(eta and xi) -1 to +1.

I did some calculations and i got results which
is a function of eta xi.

Now that i have got results, i want to plot a
surface plot.

For this i needed the exact x and y coordinates
and not eta and xi. (As eta and xi will show square plate and not the actual quadrilateral)

For this i put all the coordinates x and y in the
result in three matrices, X, Y and f.

Now their is one to one mapping of f with x and y.

In the plot i need x axis, y axis and the value f corresponding to x and y.

i am attaching the file along this.

Is this what you want?

Richard

On 5/4/2009 10:22:29 AM, rijackson wrote:
>Is this what you want?
>
>Richard


Thanx buddy. Absolutely correct.

regards
raj

There are different ways of interpreting your request. Here are solutions for two of them.
__________________
� � � � Tom Gutman
ELSID
4-Participant
(To:TomGutman)

Tom,
You posted the wrong sheet (same as the one you posted on one of my posts.

Richard, Tom
Would you happen to know why createmesh does not work? I am running MathCAD 14 M030. This appears to be a recurring theme with the command as I have had the same problem with other files recently posted on the Collab. I am attaching a screen shot of Richards file opened on my computer

Regards

If M14 Createmesh is the same algo as in previous versions, no way it will work as you specified. CreateMesh takes a function name from an implicit definition . From f(x,y) it takes Createmesh(f,,,,) and you then range x, y. It can take the X(x,y), Y(x,y), Z(x,y) as well . Createmesh(X,Y,Z,,,,,). Don't you have examples in your qs resources folder ? Your fun(x,y) generates a matrix of values. The error message is as stupid as "wrong route to the moon, you are in the train for nowhere".

jmG

This work sheet is worth + than Fort Knox. Unfortunately most 3D plots are screwed because of a permanent bug in Mathcad. Mathcad 11.2a does not retain the 3D spec's ! So annoying that for the remote reader it's a "bug". If there is red in your version, just hope some 14 user will be willing to adapt. Otherwise this worksheet is super cool .

jmG
RichardJ
19-Tanzanite
(To:ELSID)

On 5/5/2009 11:48:40 AM, ElSid wrote:

>Richard, Tom
>Would you happen to know why
>createmesh does not work? I
>am running MathCAD 14 M030.
>This appears to be a recurring
>theme with the command as I
>have had the same problem with
>other files recently posted on
>the Collab. I am attaching a
>screen shot of Richards file
>opened on my computer

That shouldn't be working for anyone. It doesn't work for me either. I just didn't bother to fix it, because it's the wrong way to plot matrices of values. CreateMesh creates matrices of x, y and z values based on a function. If you already have the matrices, not a function, it's not applicable. The example in the worksheet takes the matrix of z values and turns it into a function, and then CreateMesh is used to turn the function back into a matrix again.

CreateMesh does not like units. Divide xmin, xmax, ymin, and ymax by m. Change the last line of fun(x,y) to val[i,j<-(f[i/j)/mm and it will work. It's not very robust, because if you pick the wrong value of r then i and j take on non-integer values, but it will work.

Richard

Yep. Indeed the wrong file. But the intended sheet is long gone. And it turns out not to be what you needed anyway, which is simply to pass the three matrices to the plot.
__________________
� � � � Tom Gutman
Top Tags