필터 지우기
필터 지우기

How to plot a line where the variable changes condition.

조회 수: 1 (최근 30일)
Jake
Jake 2012년 11월 25일
So from 0<x<1.8 Z=1.25*((0.72*(x/5))-((x/5).^2));
and from 1.8<x<5 Z=(1125/1024)*((0.28+(0.72*(x/5)))-((x/5).^2));
Is there anyway I can enter this without putting it into 2 different parts?
Thanks

채택된 답변

Matt J
Matt J 2012년 11월 25일
Z=@(x) 1.25*((0.72*(x/5))-((x/5).^2)).*(x>0 & x<1.8)+...
(1125/1024)*((0.28+(0.72*(x/5)))-((x/5).^2)).*(x>1.8 & x<5);

추가 답변 (1개)

bym
bym 2012년 11월 25일
c = [-.05 .18 0;...
-.0439 .1582 .3076];
b = [0,1.8,5];
f = mkpp(b,c);
xx = 0:.1:5;
plot(xx,ppval(f,xx))

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by