Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
I am new to MathCAD and the following is what I would like to achieve. Would someone able to help me with this.
Hi,
As with many forums, the attitude in here is to help people (particularly students) learn how to use Mathcad rather than do work for. People are usually very helpful if the originator shows what attempts they've made to solve the problem or explain some particular aspect that is causing them problems.
What have you been taught/learned so far about Mathcad? What do you already know about arrays (vectors, matrices), array functions (such as stack, rows and last), and range variables? , Do you know about programming.
Assuming you're a student, there are several ways to locate the minimum element in an array but the best solution for you depends to some degree upon what you've been taught and how you might be expected to solve the problem. For instance, there are lookup functions that will find the index of the minimum element of an array, but it's also quite easy to write a program/function that will find the index .. depends what the course expectation is and the marking scheme as to which one you might choose.
However, further assuming that it's an open problem, then lookup the function match and get a feel for how it (and the other lookup functions) work. If you type, say, match(min(A),A) this will return a vector listing the indices of all the elements of vector A that contain the minimum value of A. If there's a single minimum, then you just need to extract the index from the result vector and use that to set the corresponding element in your vector B.
Creating an array the same size as another can also be done in several ways. One is to find the index of the last element of the original vector A, then simply define the index of the new vector to be 0 units. Another way is to define B:=A*0.
Stuart