Piecewise function plot help
    8 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Mohammad Ali
 am 25 Nov. 2020
  
    
    
    
    
    Bearbeitet: Setsuna Yuuki.
      
 am 25 Nov. 2020
            I am trying to graph this Piecewise function matlab. I am facing an issue with the graph . Its wrong. I am just rying to show that the median is equal to 2.16 approximately
Here is my script and i hope someone edit on it and not create his own solution.
x1 = [0:0.1:1];
f1 = 0;
x2 = [1:0.1:3];
f2 = [1/12*t1.^2 + 1/6*t1 - 1/4];
x3 = [3:0.1:0];
f3 = 1;
figure
plot(x1,f1,x2,f2,x3,f3)

0 Kommentare
Akzeptierte Antwort
  Setsuna Yuuki.
      
 am 25 Nov. 2020
        
      Bearbeitet: Setsuna Yuuki.
      
 am 25 Nov. 2020
  
      The length must be the same
x1 = [0:0.1:1];
f1 = zeros(1,numel(x1)); %f1 with the same length as x1
x2 = [1:0.1:3];
f2 = [1/12*x2.^2 + 1/6*x2 - 1/4]; %change t1  --> x2
x3 = [3:0.1:4];
f3 = ones(1,numel(x3)); %f3 with the same length as x3
figure
plot(x1,f1,x2,f2,x3,f3,'LineWidth',3)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Surface and Mesh 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!

