02-01-2011 07:36 AM
Hello,
Firstly,I would like to apologize for the improvised translation of general LABVIEW terminology. Unfortunately,I'm not exactly familiar with it and living in a non english speaking country which has it's own terms does not help.
The problem I'm experiencing is related to the following syntax:
x=0:2:20;
y=x*tan(U)-g*x^2/2*Vo^2*(1+tan(U)^2);
plot(x,y);
xlabel('x');
ylabel('y=x*tan(U)-g*x^2/2*Vo^2*(1+tan(U)^2)');
title('grafic');
When trying to submit the graphic,the following error occurs :"Error in function mpower at line 2. Analysis: The input matrix must be a square matrix." so I know I'm doing something wrong but I'm having a hard time pinpointing it.
That being said,can any of you fine gentlemen give me a hand in sorting this out? It would be greatly apreciated.
Thank you kindly,
Sabin Caragea
02-01-2011 09:25 AM
Can you attach the part of your LabVIEW code where you try and perform this?
02-01-2011 09:25 AM
Your question is quite confusing. LabVIEW is a graphical language, but you posted what looks like Matlab code. Are you trying to use the Matlab Script Node, or are you trying to use MathScript? I also don't see mpower anywhere in the text code you posted.
If possible, please upload your VI.
02-01-2011 09:32 AM
Thank you so much for your replies.
I'm trying to write it in a Mathscript node.
Attached is the VI file,as requested.
Thank you kindly,
Sabin Caragea
02-01-2011 09:51 AM
Your problem is that the ^ operation basically performs the mpower operation, and mpower requires square matrices. The x array that you are creating is not square. Hence, the operation fails on the second line. You would need to rewrite the MathScript code so you use the power function to make your power operations. The LabVIEW Help provide details on the MathScript functions. You can also open an independent MathScript window to try out your code (Tools -> MathScript Window).
02-01-2011 10:03 AM
Kudos to you,sir.
Thanks for replying.
02-03-2011 03:39 AM
The .^ operator (a dot and then the ^) might also be useful, depending on what you're trying to do. It performs element-by-element power instead of matrix power.
For example:
A = [1 2; 3 4] B = A^2 % same as the matrix multiplication B = A*A, which is [7 10; 15 22] C = A.^2 % same as the element multiplication C = A.*A, which is [1 4; 9 16]
jattas
LabVIEW R&D