How to edit properties of a plot and highlight certain points in the graph at the same time?
    9 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    theblueeyeswhitedragon
 am 7 Okt. 2017
  
    
    
    
    
    Beantwortet: Kian Azami
      
 am 7 Okt. 2017
             This is the code I wrote for graphing the Phase Plot of the differential equation dy/dt = y(y-2)(y-2)(y-4)(y-6),
 but I am getting errors for this line of the code:plot(y, yPrime, 'Color', 'Red', 'LineWidth', 2, eqPoints, zerosVec, 'k*');
Complete Code:
 %%Phase Plot 
y = -1 : 0.01 : 7; %define the values of y
yPrime = y.*((y-2).^2).*(y-4).*(y-6); %differential equation
eqPoints = roots([1 -14 68 -136 96 0]); %find the critical points 
zerosVec = zeros(length(eqPoints), 1); %create a zeros vector with length equal to the number of roots of the polynomial
plot(y, yPrime, 'Color', 'Red', 'LineWidth', 2, eqPoints, zerosVec, 'k*');
xlabel('y'); 
ylabel('dy/dt');
title('Phase Plot');
0 Kommentare
Akzeptierte Antwort
  Kian Azami
      
 am 7 Okt. 2017
        Mario you are using a wrong command for highlighting your points. Just you need a very small change to highlight the points as follow (if I understood correctly):
plot(y, yPrime, 'Color', 'r', 'LineWidth', 2)
hold on
plot(eqPoints, zerosVec, 'k*')
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Assembly 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!

