How to get tau for every c and plot a c vs tau graph

조회 수: 9 (최근 30일)
Atom
Atom 2013년 4월 16일
How to get tau for every c from the equation "tau=acos(((omega^2*(D1-A*B)-C*D1)/(B^2*omega^2+D1^2))/omega)" where A, B, C, D1, omega, x, y depends on c.
clc
clear
close all
r=3.3;
K=898;
alpha=0.045;
d=1.06;
h=0.0437;
theta=0.215;
for c=.1:.1:.9
x=d/(alpha*(theta - d*h)*(1 - c));
y=r*(K-x)*(1+alpha*h*x*(1-c))/(1 - c)*K*alpha;
A=r*d*(alpha*K*h*(1-c)-1-2*alpha*h*(1-c)*x)/(alpha*theta*K*(1-c))-d;
B=d;
C=-r*d^2*(alpha*K*h*(1-c)-1-2*alpha*h*(1-c)*x)/alpha*theta*K*(1-c);
D1=r*d^2*(alpha*K*h*(1-c)-1-2*alpha*h*(1-c)*x)/x*theta*K*(1-c)+r*d^2*(K-x)/alpha*K*theta*(1-c)*x;
omega=sqrt(((A^2-B^2-2*C)+sqrt((A^2-B^2-2*C)^2-4*(C^2-D1^2)))/2);
tau=acos(((omega^2*(D1-A*B)-C*D1)/(B^2*omega^2+D1^2))/omega);
plot(c,tau)
end

채택된 답변

Iman Ansari
Iman Ansari 2013년 4월 16일
Hi
clc
clear
close all
r=3.3;
K=898;
alpha=0.045;
d=1.06;
h=0.0437;
theta=0.215;
i=1;
for c=.1:.1:.9
x=d/(alpha*(theta - d*h)*(1 - c));
y=r*(K-x)*(1+alpha*h*x*(1-c))/(1 - c)*K*alpha;
A=r*d*(alpha*K*h*(1-c)-1-2*alpha*h*(1-c)*x)/(alpha*theta*K*(1-c))-d;
B=d;
C=-r*d^2*(alpha*K*h*(1-c)-1-2*alpha*h*(1-c)*x)/alpha*theta*K*(1-c);
D1=r*d^2*(alpha*K*h*(1-c)-1-2*alpha*h*(1-c)*x)/x*theta*K*(1-c)+r*d^2*(K-x)/alpha*K*theta*(1-c)*x;
omega=sqrt(((A^2-B^2-2*C)+sqrt((A^2-B^2-2*C)^2-4*(C^2-D1^2)))/2);
tau(i)=acos(((omega^2*(D1-A*B)-C*D1)/(B^2*omega^2+D1^2))/omega);
i=i+1;
end
plot(.1:.1:.9,tau)
  댓글 수: 5
Iman Ansari
Iman Ansari 2013년 4월 16일
To plot continuous you need to have two value in each loop for plotting a line. I used tau_0 and c_0 to store previous position in each loop:
clc
clear
close all
r=3.3;
K=898;
alpha=0.045;
d=1.06;
h=0.0437;
theta=0.215;
for c=.1:.001:.9
x=d/(alpha*(theta - d*h)*(1 - c));
y=r*(K-x)*(1+alpha*h*x*(1-c))/(1 - c)*K*alpha;
A=r*d*(alpha*K*h*(1-c)-1-2*alpha*h*(1-c)*x)/(alpha*theta*K*(1-c))-d;
B=d;
C=-r*d^2*(alpha*K*h*(1-c)-1-2*alpha*h*(1-c)*x)/alpha*theta*K*(1-c);
D1=r*d^2*(alpha*K*h*(1-c)-1-2*alpha*h*(1-c)*x)/x*theta*K*(1-c)+r*d^2*(K-x)/alpha*K*theta*(1-c)*x;
omega=sqrt(((A^2-B^2-2*C)+sqrt((A^2-B^2-2*C)^2-4*(C^2-D1^2)))/2);
tau=acos(((omega^2*(D1-A*B)-C*D1)/(B^2*omega^2+D1^2))/omega);
if c>0.1
plot([c_0 c],[tau_0 tau])
end
tau_0=tau;
c_0=c;
hold on
end
xlabel('c');
ylabel('tau');
Atom
Atom 2013년 4월 16일
Thank you Mr Ansari. Your work helps me a lot. Thank you. Hope I will get help from you in future.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by