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

채택된 답변

KSSV
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 ;

추가 답변 (1개)

David Hill
David Hill 2022년 5월 5일
dydx=@(x)-cos(x)./(sin(x).^2);
dydx(sqrt(1/2))

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by