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

stack option

SOLVED
Regular Member

stack option

Hi, I was trying to stack all the x coordinates together and all y coordinates together. I see an additional value (0,0) in the result w and v. Can you please tell me why is the additional rows generated and how to eliminate it. And i am using mathcad 15

Thank You.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: stack option

Can't see your sheet...
Maybe because you started indexing at 1, while the default start index is 0?

Luc

P.s. you don't need to zip your file.
Mcd, mcdx and xmcd files can be readily attached. To attach several files, edit your post.

View solution in original post

20 REPLIES 20
Highlighted

Re: stack option

Can't see your sheet...
Maybe because you started indexing at 1, while the default start index is 0?

Luc

P.s. you don't need to zip your file.
Mcd, mcdx and xmcd files can be readily attached. To attach several files, edit your post.

View solution in original post

Re: stack option

Luc is using Mathcad 11 and so he can't read your file. With MC15 you can resave the file in MC11 format, though (something which is not possible with Prime). I attach the file in MC11 format here.

Attaching the worksheet usually is a good idea and quite often simply necessary. But its also a good idea to attach a screenshot, too 😉

Lucs guess was correct. The setting of ORIGIN in your sheet is the default value 0, so every vector starts indexing with number zero. You created a range variable j which started at 1 and assigned values. So vector element with number 1 gets the correct value 4.5 in, but there still exists a vector element with number 0. This is not assigned a value and so its set to zero by default.

To display the vector y.a you typed y.a[j= which only gives you the elements defined by range j, but not the full vector. If you simply type y.a= you see the full vector with the leading zero.

Rule: If you use a range variable to define vector this range should start with the value of ORIGIN.

Here a small example to demonstrate what happened:

clipboard_image_1.png

 

Re: stack option

Thank you for the explanation i was trying to eliminate the set of coordinates which are repeated. They coincide with the vertices of the rectangle, by starting the index j from 1 i wanted to eliminate the repetition. can you suggest me a way to remove Capture2.PNG the repeated coordinates?

 

Thank you

Re: stack option

Note sure what you mean. Which vertices, which rectangle?

Do these changes address your problem?

clipboard_image_0.png

Re: stack option

Thanks for the idea it helped me get what i needed. When i changed the value of m=0,1,2 the j value becomes undefined. so can i give "if" command to consider e and f  instead of w and v if the m is given less than 3??1.PNG2.PNG

 

Re: stack option


@rizz12 wrote:

Thanks for the idea it helped me get what i needed. When i changed the value of m=0 the j value becomes undefined. so can i give "if" command to consider e and f  instead of w and v if the m is given 0??

 


You get the error because when m=2 you try to use a vector index of -1 (m-3). You can't use a vector index lower than the value of ORIGIN (which is 0).

I guess you could use something with an if construct when you create xp,  but I have the feeling that the vectors you are after (guess they are lists of coordinates ?) can be calculated much easier than the way you try to do it. But unfortunately I have no clue what exactly you are trying to do, maybe you'd like to explain in more detail.

Are you trying to get a list of the m x n coordinates if you divide a l x b rectangle into (m-1) x (n-1) smaller rectangles? But if thats what you are after then n=4 and m=3 should give you a vector with 12 coordinates, not just 9. So maybe you are looking for something else.

 

 

Re: stack option

the coordinates are the bolt location. i am trying to calculate the forces on them. based on the formulas i have given earlier some coordinates were coinciding. so i was trying to eliminate them. if m is less than 3 the j becomes undefined and stops the calculation. so i was trying to use e and f function by using if statement in case if m<3 and want to make the j index terms zero.2.PNG3.jpeg

Re: stack option

Guess I got it.

I would prefer to write a more generic function to do the job:

clipboard_image_0.png

 

Mathcad 15 worksheet attached

Re: stack option

Think it would be better if the functions returns a 2-column matrix instead. Your choice anyway.

clipboard_image_0.png