Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Graph help in matlab

조회 수: 1 (최근 30일)
Rooter Boy
Rooter Boy 2020년 10월 26일
마감: MATLAB Answer Bot 2021년 8월 20일
I need matlab code of this graph according to these conditions;
if the r value is lower than r1 and above than 0 use the formula L1.
if the r value between r1 and r2 use the formula L2.
if the r value greater than r2 use the formula L3.
Would you help me please?

답변 (1개)

Star Strider
Star Strider 2020년 10월 26일
This is not your function, however it illustrates the ‘logical indexing’ approach to such problems:
f = @(x) (2-2*x).*(x <= 0) + (2+2*x).*(x>0);
t = linspace(-3, 3);
figure
plot(t, f(t))
grid
ylim([0 max(ylim)])
Run it and view the plot it produces.
It is not difficult to figure out how it works. Be inspired by it!

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by