Borrar filtros
Borrar filtros

can i have 3 different graphs in a same m-file?

1 visualización (últimos 30 días)
Natalia Wong
Natalia Wong el 22 de Nov. de 2015
Respondida: Image Analyst el 22 de Nov. de 2015
Hi I have plotted 3 different graphs in a single m-file but I can only view one graph. How to make all 3graphs pop out simultaneously. And, if i want to plot a red asterisk at let's say when the y-coordinate is more than 20, how do i do it? 'r*' >20? I tried but can't
Thanks and Im new to MATLAB

Respuesta aceptada

Image Analyst
Image Analyst el 22 de Nov. de 2015
Use subplot, and set elements you don't want to display to nan.
Try this:
y1 = randi(50, 1, 20);
subplot(3,1,1);
plot(y1, 'b-');
hold on;
yBig = y1;
yBig(y1 <= 20) = nan;
plot(yBig, 'r*', 'LineWidth', 2, 'MarkerSize', 9);
grid on;
y2 = randi(50, 1, 20);
subplot(3,1,2);
plot(y2, 'b-');
hold on;
yBig = y2;
yBig(y2 <= 20) = nan;
plot(yBig, 'r*', 'LineWidth', 2, 'MarkerSize', 9);
grid on;
y3 = randi(50, 1, 20);
subplot(3,1,3);
plot(y3, 'b-');
hold on;
yBig = y3;
yBig(y3 <= 20) = nan;
plot(yBig, 'r*', 'LineWidth', 2, 'MarkerSize', 9);
grid on;

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by