How can I change a certain part of a graph to a certain constant value?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
SIM M.S.
le 19 Avr 2017
Modifié(e) : Andrew Newell
le 19 Avr 2017
For example, this is a sine graph.
x = linspace(0,2*pi,100);
y = sin(x);
plot(x,y)
How to change the value of y to be y = sin(0.2*pi) at x = 0.2*pi to 0.8*pi? so that the graph appears to be sine graph, except it is a horizontal straight line from x = 0.2*pi to 0.8*pi.
Thank you in advance.
0 commentaires
Réponse acceptée
Andrew Newell
le 19 Avr 2017
Modifié(e) : Andrew Newell
le 19 Avr 2017
Here is one way:
y(x>=0.2*pi & x<=0.8*pi) = sin(0.2*pi);
Note that I use inequalities because there are no values of x that are exactly 0.2*pi or 0.8*pi.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!