how to use loop in function to plot
조회 수: 1 (최근 30일)
이전 댓글 표시
function y=f(x)
np=1.5;
a=1.2;
b=3;
x=np*sin(theta);
k1=sqrt(a-x^2);
k2=ksqrt(b-x^2);
y=(k1-k2)/(k1+k2);
end
how to determine the delta(y)/ delta(x)/ with the variation of theta;
delta means change in value of parameter how to write using loop
pl help to plot delta(y)/delta(x) vs theta
댓글 수: 3
Walter Roberson
2022년 1월 8일
how to determine the delta(y)/ delta(x)/ with the variation of theta;
x is a function of theta, so you are asking to take the derivative of function y with respect to function x,
답변 (2개)
Walter Roberson
2022년 1월 8일
syms x(theta)
np=1.5;
a=1.2;
b=3;
X=np*sin(theta);
k1=sqrt(a-x^2);
k2=sqrt(b-x^2);
y=(k1-k2)/(k1+k2);
dydx = functionalDerivative(y,x)
dydtheta = simplify(subs(dydx, x, X))
fplot(dydtheta, [-2*pi 2*pi])
댓글 수: 0
Mathieu NOE
2022년 1월 8일
hello
try this
I modified your function because x and y are both outputs
theta = linspace(0,2*pi,100);
figure(1)
[x,y]=f(theta);
dx = gradient(x);
dy = gradient(y);
plot(theta,dy./dx);
%%%%%%%%%%%%%%%%%%%
function [x,y]=f(theta)
np=1.5;
a=1.2;
b=3;
x=np*sin(theta);
k1=sqrt(a-x.^2);
k2=sqrt(b-x.^2);
y=(k1-k2)./(k1+k2);
end
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!