Why won't my hold on work?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I am trying to plot a piece wise function using fplot. The code won't retain the previous graphs. I tried even using the example code that is online with mathwork and even that doesn't work! it only plots the second equation! What is going with matlab!?
This is my code
clc; clf;
fplot(@(x) ((-1/4)*x^2 + 11.8125),[0 6],'r')
hold on
fplot(@(x) ((-1/4)*x^2 + 11.8125 + .5*(x-6)^2),[6 12],'r')
hold off
grid on
This is the code from mathwork that I pretty much copied. Same idea, I just needed different equations. Neither work!I think something is wrong with my hold on.
fplot(@(x) exp(x),[-3 0],'b')
hold on
fplot(@(x) cos(x),[0 3],'b')
hold off
grid on
3 Commenti
Risposte (1)
Walter Roberson
il 8 Nov 2016
The problem is not hold on, the problem is fplot, which in R2015a made no attempt to check to see if it was on a held axes. R2016a is the first version of fplot that respects hold on
1 Commento
Vedere anche
Categorie
Scopri di più su Line Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!