how can i find the x Value

조회 수: 3 (최근 30일)
Nimbuzz Kurodo
Nimbuzz Kurodo 2021년 10월 5일
답변: Star Strider 2021년 10월 5일
I have this three line code, how can i define "x" value
part1 = @(x) (x >= 5).*(10*sqrt(x) + 25);
part2 = @(x) (x >= 0 & x <= 4).*(10*x + 25);
part3 = @(x) (x < 2) .*25;

답변 (1개)

Star Strider
Star Strider 2021년 10월 5일
One option is linspace
x = linspace(-25, 25, 250);
part1 = @(x) (x >= 5).*(10*sqrt(x) + 25);
part2 = @(x) (x >= 0 & x <= 4).*(10*x + 25);
part3 = @(x) (x < 2) .*25;
figure
plot(x, part1(x))
hold on
plot(x, part2(x))
plot(x, part3(x))
hold off
grid
legend('part1','part2','part3', 'Location','best')
.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by