x=0:pi/100:2*pi; y=sin(x); if x>3 plot(x,y,"b*") else x<=3; plot(x,y,"g*") end I Want PLot X>3 using Defferent Color

19 次查看(过去 30 天)
clc;clear;close all
x=0:pi/100:2*pi;
y=sin(x);
if x>3
plot(x,y,"b*")
else x<=3;
plot(x,y,"g*")
end

采纳的回答

Walter Roberson
Walter Roberson 2021-12-3
x=0:pi/100:2*pi;
y=sin(x);
mask = x > 3;
plot(x(mask), y(mask), "b*")
hold on
plot(x(~mask), y(~mask), "g*")
hold off

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by