mve=2./pi.*atan((c1*cos(u.*theta)+c2.*cos(t.*theta)+d1.*cos(y.*theta)+d2.*cos(x.*theta))./(a1.*sin(s.*theta)+a2.*sin(r.*theta)+b1.*sin(w.*theta)+b2.*sin(v.*theta)))
I want to solve theta for a given range of value of mve where mve ranges from 0 to 1.
how can i do that?
value of all other variables are given.

 採用された回答

Star Strider
Star Strider 2019 年 10 月 6 日

1 投票

One approach:
mve_fcn = @(theta,mve) 2./pi.*atan((c1*cos(u.*theta)+c2.*cos(t.*theta)+d1.*cos(y.*theta)+d2.*cos(x.*theta))./(a1.*sin(s.*theta)+a2.*sin(r.*theta)+b1.*sin(w.*theta)+b2.*sin(v.*theta))) - mve;
mvev = linspace(0, 1, 10)
for k = 1:numel(mvev)
thetav(k) = fsolve(@(theta) mve_fcn(theta, mvev(k)), 1);
end
You can also use fzero instead of fsolve.
I am not certain what you want to do, or the values of your other variables. I cannot test this so I am posting it as UNTESTED CODE.

5 件のコメント

Mariam Maroof
Mariam Maroof 2019 年 10 月 6 日
why have u taken mve from 0 to 10?
John D'Errico
John D'Errico 2019 年 10 月 6 日
編集済み: John D'Errico 2019 年 10 月 6 日
The call to linspace as used
mvev = linspace(0, 1, 10);
goes from 0 to 1, with 10 steps. The end point is NOT 10, but 1.
I suppose it might easily be misinterpreted to end at 10.
Star Strider
Star Strider 2019 年 10 月 6 日
@John D’Errico — Thank you.
I was off doing other things, and didn’t see Mariam Maroof’s Comment until now.
Mariam Maroof
Mariam Maroof 2019 年 10 月 6 日
Thank you both of you!
Star Strider
Star Strider 2019 年 10 月 6 日
As always, our pleasure!

サインインしてコメントする。

その他の回答 (1 件)

Mariam Maroof
Mariam Maroof 2019 年 10 月 7 日
編集済み: Mariam Maroof 2019 年 10 月 7 日

0 投票

I tried to pass the value of thetav(k) to solve system of linear equations given as:
eqn1=kvp1./(sqrt(2.*pi).*rcv(i,1).^s).*(-a1.*sin(s.*thetav(k))-a2.*sin(r.*thetav(k))-b1.*sin(w.*thetav(k))-b2.*(sin(v.*thetav(k))))+kvp2./(sqrt(2.*pi).*rcv(i,1).^u).*(c1.*cos(u.*thetav(k))+c2.*cos(t.*thetav(k))+d1.*cos(y.*thetav(k))+d2.*cos(x.*thetav(k)))==0;
eqn2=kvp1.*(l.*(r.*cos(s.*thetav(k))+xb1(1).*s.*cos(r.*thetav(k)))+(f1.*cos(w.*thetav(k))+f2.*(cos(v.*thetav(k)))))+kvp2.*(g1.*sin(u.*thetav(k))+g2.*sin(t.*thetav(k))+h1.*sin(y.*thetav(k))-h2.*sin(x.*thetav(k)))==e1;
[A,B] = equationsToMatrix([eqn1, eqn2], [kvp1, kvp2]);
X = linsolve(A,B);
plot(X(1)/kic(i,1),X(2)/kic(i,1),'.')
but unable to get the correct values of kvp1 and kvp2 for each values of theta(v).
'i' is given as an outer loop.
the curve must come out to be cubic polynomial.

10 件のコメント

Star Strider
Star Strider 2019 年 10 月 7 日
It would definitely help to have values for the constants. I cannot help you without them.
Mariam Maroof
Mariam Maroof 2019 年 10 月 7 日
the code goes likes this:
syms theta kvp1 kvp2
kic=[2.05e6 2.2e6 2.65e6; 2.5e6 2.93e6 3.6e6; 3.2e6 3.52e6 4.85e6];
alpha2=[30*pi./180 60*pi./180 90*pi./180];
rho=[1e-3 2e-3 4e-3];
rcv=[0.49e-3 0.45e-3 0.34e-3; 0.87e-3 0.85e-3 0.68e-3; 1.57e-3 1.43e-3 1.33e-3];
for i=1:1:3 %for variation of rcv and kic
ro=(pi-alpha2(1)).*rho(i)./(2.*pi-alpha2(1));
lambda1=[0.5014 0.5122 0.5448];
lambda2=[0.5982 0.7309 0.9085];
mu1=[-0.4561 -0.4057 -0.3449];
mu2=[-0.4465 -0.3731 -0.2882];
xb1=[1.0707 1.3123 1.8414];
xb2=[0.9212 0.6584 0.2189];
xc1=[3.7907 3.2832 2.5057];
xc2=[-11.3503 -8.3946 -2.9382];
xd1=[0.0632 0.0960 0.1046];
xd2=[-0.3506 -0.4788 -0.2436];
qq=(2.*pi-alpha2(1))./pi;
s=1-lambda1(1);
r=1+lambda1(1);
u=1-lambda2(1);
t=1+lambda2(1);
w=1-mu1(1);
v=1+mu1(1);
y=1-mu2(1);
x=1+mu2(1);
p=v-r;
q=x-t;
h=rcv(i,1)./ro;
l=1./(r+xb1(1).*s);
m=qq.*l./(4.*(qq-1));
n=1./(u+xb2(1).*t);
o=n./(4.*(-y));
%term1=n*(t*u*cos(u*theta)+xb2*t*t*cos(t*theta));
%term2=h.^q*o*(xd2*x*y*cos(y*theta)-xc2*x*cos(x*theta));
%term3=l*(-r*s*sin(s*theta)-r*s*xb1*sin(r*theta));
%term4=h.^p*m*(-xd1*v*w*sin(w*theta)-xc1*v*sin(v*theta));
c1=n.*(t.*u);
c2=n.*xb2(1).*t.^2;
d1=(h.^q).*o.*(xd2(1).*x.*y);
d2=(h.^q).*o.*(-xc2(1).*x);
a1=l.*(r.*s);
a2=l.*(r.*s.*xb1(1));
b1=(h.^p).*m.*(xd1(1).*v.*w);
b2=(h.^p).*m.*(xc1(1).*v);
f1=(h.^p).*m.*xd1(1).*v;
f2=(h.^p).*m.*xc1(1);
g1=(rcv(i,1).^(s-u)).*n.*t;
g2=(rcv(i,1).^(s-u)).*n.*t.*xb2(1);
h1=h.^q.*o.*xd2(1).*x;
h2=h.^q.*o.*xc2(1);
e1=kic(i,1).*(l.*(r+xb1(1).*s)+h.^p.*m.*(xd1(1).*v+xc1(1)));
%kvpsol = solve([eqn2, eqn3], [kvp1, kvp2]);
%kvp1Sol = sol.kvp1;
%kvp2Sol = sol.kvp2;
%plot(kvp1/kic,kvp2/kic,'-'); hold on
mve_fcn = @(theta,mve) 2./pi.*atan((c1*cos(u.*theta)+c2.*cos(t.*theta)+d1.*cos(y.*theta)+d2.*cos(x.*theta))./(a1.*sin(s.*theta)+a2.*sin(r.*theta)+b1.*sin(w.*theta)+b2.*sin(v.*theta))) - mve;
mvev = linspace(0, 1, 10);
for k = 1:numel(mvev)
thetav(k) = fsolve(@(theta) mve_fcn(theta, mvev(k)), 1);
eqn2=kvp1./(sqrt(2.*pi).*rcv(i,1).^s).*(-a1.*sin(s.*thetav(k))-a2.*sin(r.*thetav(k))-b1.*sin(w.*thetav(k))-b2.*(sin(v.*thetav(k))))+kvp2./(sqrt(2.*pi).*rcv(i,1).^u).*(c1.*cos(u.*thetav(k))+c2.*cos(t.*thetav(k))+d1.*cos(y.*thetav(k))+d2.*cos(x.*thetav(k)))==0;
eqn3=kvp1.*(l.*(r.*cos(s.*thetav(k))+xb1(1).*s.*cos(r.*thetav(k)))+(f1.*cos(w.*thetav(k))+f2.*(cos(v.*thetav(k)))))+kvp2.*(g1.*sin(u.*thetav(k))+g2.*sin(t.*thetav(k))+h1.*sin(y.*thetav(k))-h2.*sin(x.*thetav(k)))==e1;
[A,B] = equationsToMatrix([eqn2, eqn3], [kvp1, kvp2]);
X = linsolve(A,B);
%kvpsol = solve([eqn2, eqn3], [kvp1, kvp2]);
%kvp1Sol = sol.kvp1;
%kvp2Sol = sol.kvp2;
plot(X(1)/kic(i,1),X(2)/kic(i,1),'.'); hold on
end
end
Star Strider
Star Strider 2019 年 10 月 7 日
The code you posted runs without error.
What are ‘the correct values of kvp1 and kvp2 for each values of theta(v)’?
I have no idea what you are doing.
Mariam Maroof
Mariam Maroof 2019 年 10 月 7 日
on plotting :
plot(mvev(k),thetav(k)*180/pi,'.')
i m getting the curve:
a_30_r_1,2,4_theta.jpg
similarly by plotting:
plot(X(1)/kic(i,1),X(2)/kic(i,1),'.')
i should get same kind of curve but instead of that i am getting:
xxx.jpg
Mariam Maroof
Mariam Maroof 2019 年 10 月 7 日
for example, almost these values should come at mev=0:
theta=52.55(deg.)
kvp2/kic=5.19
kvp1/kic=0
Star Strider
Star Strider 2019 年 10 月 7 日
I apologise, however I cannot help you with that. I do not see any obvious problems with your code. I do not know what you are doing in your code, so I can only assume it is correct. It appears to be far outside my areas of expertise, so I cannot determine from looking at it if there are any errors.
I note that in the top plot image, you are calculating three different y-values at every x-value. Potential problems could be missing or misplaced parentheses, or other sorts of errors that I cannot determine. It would be best for you to go through your code very carefully to be certain your code matches the equations you are coding.
Mariam Maroof
Mariam Maroof 2019 年 10 月 7 日
Its okey @Star Strider . Thank you for your efforts and suggestions.
I just wanna know will there be any issue in plotting the graph if the units are different.
since unit of kic and kvp1 is MPa-m^(1-lambda1) and that of kvp2 is MPa-m^(1-lambda2).
this makes the x-axis dimensionless and y axis with a dimension of m^(lamda1-lambda2).
Star Strider
Star Strider 2019 年 10 月 7 日
There could be an issue if the units are different, because the values of ‘kvp1’ and ‘kvp2’ could be different as the result. You could deal with this effectively using yyaxis (or the older plotyy) to plot them on the same values of the independent variable, while keeping the units defined separately for each dependent variable.
Mariam Maroof
Mariam Maroof 2019 年 10 月 8 日
ok I will try that out. Thank you.
Star Strider
Star Strider 2019 年 10 月 8 日
As always, my pleasure.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で Mathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by