Can't plot all the four points among the inputs given in an OR Gate.

1 Ansicht (letzte 30 Tage)
Here's my code for plotting the inputs in an OR Gate but among the four inputs only three gets plotted.Can anyone provide me solution to this??
CODE:
x=[1 0;0 1;0 0;1 1];
y=[1;1;0;1];
plot(x,y,'o')
Here is the output showing only three points rather it should have showen four.
Can anyone please provide me the reason behind this and the solution to overcome this.
  2 Kommentare
James Tursa
James Tursa am 29 Mai 2020
It is not clear to me what result you want for the plot. Can you describe what your desired plot would look like?
Saptarshee Sarkar
Saptarshee Sarkar am 30 Mai 2020
My desired plot should contain a forth point at x-coordinate (1,0) as it skipping that point and showing all the other 3 points.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Ameer Hamza
Ameer Hamza am 29 Mai 2020
The way you are using plot() does not make much sense here. Using scatter() with y as the color value will show the difference f true and false values.
x=[1 0;0 1;0 0;1 1];
y=[1;1;0;1];
scatter(x(:,1),x(:,2),[],y,'filled')
colormap(cool)
  8 Kommentare
Saptarshee Sarkar
Saptarshee Sarkar am 30 Mai 2020
I have explain the lines of the code by commenting you could refer them.
The optimization ffunction "y=w0+w1*x1+w2*x2"
For the
DJ(1,1)=sum(pred_err)/m;
for j=2:n+1
DJ(j,1)=sum(pred_err.*x(:,j-1))/m;
end
here's the part which would probably explain ,I didn't mebtioned it there because of subscript and superscript.
The red line in the graph is the classiication line which would of the form or near to " x1+x2=1/2 " with assuming the values of w0 = -1 ; w1= 2 ; w3=2 for the case of OR gate.
Saptarshee Sarkar
Saptarshee Sarkar am 30 Mai 2020
Bearbeitet: Saptarshee Sarkar am 30 Mai 2020
I am also attaching few links below so that you could refer for better understanding:
Code for the logistic regression OR gate (I have copied the above written code from this video)
I would be very thankful if you kindly go through these and help me out for my issue.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Discrete Data Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by