how to find slope of sin^-1(x) curve at a given point x=sqrt(1/2)? the code of forward differentiation doesn't work for me
조회 수: 1 (최근 30일)
이전 댓글 표시
h=0.01
x = -1:h:1;
y=asind(x);
for i=1:length(x)-1
dy(i)=(y(x(i+1))-y(x(i)))/h;
end
댓글 수: 0
채택된 답변
KSSV
2022년 5월 5일
편집: KSSV
2022년 5월 5일
h=0.01 ;
x = -1:h:1;
y=asind(x);
dy = zeros(length(x)-1,1) ;
for i=1:length(x)-1
dy(i)=(y(i+1)-y(i))/h;
end
OR
h=0.01 ;
x = -1:h:1;
y = @(x) asind(x);
dy = zeros(length(x)-1,1) ;
for i=1:length(x)-1
dy(i)=(y(x(i+1))-y(x(i)))/h;
end
Actually no loop is needed:
h=0.01 ;
x = -1:h:1;
y=asind(x);
dy=diff(y)/h ;
댓글 수: 0
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!