필터 지우기
필터 지우기

i cant able to plot graph of this cord

조회 수: 2 (최근 30일)
suketu vaidya
suketu vaidya 2020년 11월 8일
답변: dpb 2020년 11월 8일
function taska
h = 1;
x = -pi:0.01:pi;
d = 50;
y0 = -1;
c1=(y0-(d^2/(d^2+1)));
y=@(x)c1*exp(-diff(x))+d*(sin(x)/(d^2+1))+d^2*(cos(x)/d^2+1);
plot(x,y(x));
end

답변 (1개)

dpb
dpb 2020년 11월 8일
y=@(x)c1*exp(-diff(x))+d*(sin(x)/(d^2+1))+d^2*(cos(x)/d^2+1);
numel(diff(x)) is one less than numel(x) so the above will fail owing to mismatch in number of elements.
But, since
x=-pi:0.01:pi;
it is so that
diff(x) --> 0.01 % within rounding error
so may as well just write as
dx=0.01;
x=-pi:dx:pi;
exp_dx=exp(-dx);
y=@(x) c1*exp_dx+d*(sin(x)/(d^2+1))+d^2*(cos(x)/d^2+1);

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by