Andy Wibroe wrote:
I am very new to Mathcad and am trying to complete an assignment in which I need to calculate the number of occurrences whereby load of a system is greater than resistance. I have created my file and programme in line with my course notes but at the end am getting an error message stating that the array in my if statement is invalid. I attach file for anyone that can help.
First, Mathcad's default index origin is 0 (zero) not 1 (one) - unlike some (eg, Matlab). But you can change it to 1 if you prefer.
Second, histogram doesn't return NSim rows (values). This gives your error, as Mathcad is trying to address an index that doesn't exist. Create a new range variable of the exact size, using the function rows.
Third, you could use the new range variable to replace ir in your sum, but it's far simpler just to use the summation operator without the range variable - Mathcad will assume you want to sum over the entire vector.
Stuart
Welcome to the PTC Community
No account yet? Create an account
Please use your PTC eSupport account.
LoginEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.

