LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Graphic

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

 

 

 

 

0 Kudos
Message 1 of 7
(3,004 Views)

Can you attach the part of your LabVIEW code where you try and perform this?

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 7
(2,978 Views)

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.

0 Kudos
Message 3 of 7
(2,977 Views)

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

0 Kudos
Message 4 of 7
(2,973 Views)

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).

Message 5 of 7
(2,955 Views)

Kudos to you,sir.

 

Thanks for replying.

0 Kudos
Message 6 of 7
(2,944 Views)

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

 

Message 7 of 7
(2,894 Views)