Clear Filters
Clear Filters

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

4 views (last 30 days)
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

Accepted Answer

Iman Ansari
Iman Ansari on 16 Apr 2013
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 Comments
Iman Ansari
Iman Ansari on 16 Apr 2013
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 on 16 Apr 2013
Thank you Mr Ansari. Your work helps me a lot. Thank you. Hope I will get help from you in future.

Sign in to comment.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!