Effacer les filtres
Effacer les filtres

I'm trying to plot this graph with the x-values between -10 and 50, but the graph plots them between 0 and 60?

1 vue (au cours des 30 derniers jours)
a = bin2dec('00010101') b = bin2dec('00010010') c = bin2dec('11000101')
x =[(-10):1:50]
y1 = (-b.*((x-a).^2))+c y2 = (c.*x)-a
hold on plot (y1) plot (y2)

Réponse acceptée

Jan
Jan le 10 Oct 2017
Modifié(e) : Jan le 10 Oct 2017
a = bin2dec('00010101');
b = bin2dec('00010010');
c = bin2dec('11000101')
x = -10:50; % Nicer and faster than: [(-10):1:50]
y1 = (-b.*((x-a).^2))+c;
y2 = (c.*x)-a;
plot(x, y1);
hold on
plot(x, y2);
You need to specify x in the plot() command, otherwise Matlab assumes it is 1:length(y).

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by