Why is the dashed red line for the second plot in the following code not appearing when I run the code?
Mostra commenti meno recenti
I am using matlab r2014 on a macbook and I can't get the second plot to appear with a dashed red line. Here is the code:
for n=(10:100) k=(0:n); pie= 4*sum(((-1).^k)./(2.*k+1)); a(n-9)= pie end m=[10:100]; hold on plot(m,a) plot(m,pi,'--r') hold off
Risposte (1)
Mischa Kim
il 16 Set 2014
Modificato: Mischa Kim
il 16 Set 2014
Manuel, use
plot(m,pi*ones(size(m)),'--r')
instead. The first and second arguments in the plot command should be vectors of equal size.
Categorie
Scopri di più su Line Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!