LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot this..?

x = 0:0.5:1 

params = [0 0.5 1]

for i=1:length(x)

if x(i)<params(1)

y(i)= 2 * abs(x(i) - 0.5);

elseif x(i)<params(2)

y(i)= 2 * abs(x(i) - 0.5);

else x(i)<params(3)

y(i)= 2 * abs(x(i) - 0.5);

end

end

out=y';

plot(x,out)

 

I have a this simple program.

How to plot this in LABVIEW block diagram or Front panel.?

 

How the plot will look like is attached here.. please help..

0 Kudos
Message 1 of 6
(3,054 Views)

What have you done so fare ?

How much do you know about LabVIEW ?

 

I will give you some clues: For loop, Autoindexing, Ramp, basic math, and a xy-graph.

0 Kudos
Message 2 of 6
(3,031 Views)

Hi means,

                         Its very simple but tell me why line 5,7,9 statements are same, It is else part so it should be different from each other right ?

 

Doesnot make any sense.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 3 of 6
(3,002 Views)

It will be same because
length(x)= 3

so if x(1)<params(1)
y(1) = 2* abs(x(1) - 0.5)

 

 

and so on..

 

Here i will be maximum 3 and same params is also 3

0 Kudos
Message 4 of 6
(2,984 Views)

I am totally new to labview and want to enter in this field.

 

Before this i just seen a demo from NI person that taking one knob and connecting it to meter..

 

Ok.. I will try now with the elements you given and will come back here..

0 Kudos
Message 5 of 6
(2,983 Views)

I think Ranjeet meant that since the equasion in the cases is identacle you don't need the If.  Or For loops or params[] at all and a postage stamp size BD is all that you need.

1!.PNG


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 6
(2,949 Views)