Not getting curve in my graph

3 ビュー (過去 30 日間)
Kristine
Kristine 2022 年 8 月 6 日
回答済み: Star Strider 2022 年 8 月 6 日
When I plot K1 and K2 seperately, I get two graphs for the values so I know the numbers are not static. However, when I try to use them in my theta equation to then get a curve of the theta value, it just plots a straight line. Any ideas?
n=100;
s=zeros(n,1);
F=zeros(n,1);
W=zeros(n,1);
K1=zeros(n,1);
K2=zeros(n,1);
ybar= linspace(0,0.4,n);
Sxx = -(-log((ybar).^2)-1-(-log((-2).^2+(ybar).^2-(ybar.^2./((-2).^2+ybar.^2)))));
Sxy = (atan(-2./(ybar)+(((ybar)+(-2))./((-2)^2+(ybar).^2))));
for i=1:n
s(i)=cos(((2*i-1)*pi())/(2*(2*n+1)))^2;
W(i)=s(i)*((2*pi())/(2*n+1));
F(i)=(1-s(i)^2)*(0.2945-.3912*s(i)^2+0.7685*s(i)^4-0.9942*s(i)^6+0.5094*s(i)^8);
K1(i)=(1/(2*pi()^2))*W(i)*Sxx(n)*((1+F(i))/sqrt(s(i)*(1+s(i))));
end
for i=1:n
s(i)=cos(((2*i-1)*pi())/(2*(2*n+1)))^2;
W(i)=s(i)*((2*pi())/(2*n+1));
F(i)=(1-s(i)^2)*(0.2945-.3912*s(i)^2+0.7685*s(i)^4-0.9942*s(i)^6+0.5094*s(i)^8);
K2(i)=(1/(2*pi()^2))*W(i)*Sxy(n)*((1+F(i))/sqrt(s(i)*(1+s(i))));
end
for i=1:n
theta=2*atan(((1/4)*K1(n)/K2(n)))+((1/4)*((((K1(n)/K2(n)))^(.5))+9)^(.5));
end
hold on
figure(1)
plot(ybar,theta,'.');
xlabel('y/L');
ylabel('theta [deg]')
hold off

採用された回答

Star Strider
Star Strider 2022 年 8 月 6 日
Any ideas?
Yes.
Subscript ‘theta’ and all the argument vectors using the loop index ‘i’ rather than ‘n’.
n=100;
s=zeros(n,1);
F=zeros(n,1);
W=zeros(n,1);
K1=zeros(n,1);
K2=zeros(n,1);
ybar= linspace(0,0.4,n);
Sxx = -(-log((ybar).^2)-1-(-log((-2).^2+(ybar).^2-(ybar.^2./((-2).^2+ybar.^2)))));
Sxy = (atan(-2./(ybar)+(((ybar)+(-2))./((-2)^2+(ybar).^2))));
for i=1:n
s(i)=cos(((2*i-1)*pi())/(2*(2*n+1)))^2;
W(i)=s(i)*((2*pi())/(2*n+1));
F(i)=(1-s(i)^2)*(0.2945-.3912*s(i)^2+0.7685*s(i)^4-0.9942*s(i)^6+0.5094*s(i)^8);
K1(i)=(1/(2*pi()^2))*W(i)*Sxx(n)*((1+F(i))/sqrt(s(i)*(1+s(i))));
end
for i=1:n
s(i)=cos(((2*i-1)*pi())/(2*(2*n+1)))^2;
W(i)=s(i)*((2*pi())/(2*n+1));
F(i)=(1-s(i)^2)*(0.2945-.3912*s(i)^2+0.7685*s(i)^4-0.9942*s(i)^6+0.5094*s(i)^8);
K2(i)=(1/(2*pi()^2))*W(i)*Sxy(n)*((1+F(i))/sqrt(s(i)*(1+s(i))));
end
for i=1:n
theta(i)=2*atan(((1/4)*K1(i)/K2(n)))+((1/4)*((((K1(i)/K2(i)))^(.5))+9)^(.5));
end
hold on
figure(1)
plot(ybar,theta,'.');
xlabel('y/L');
ylabel('theta [deg]')
hold off
Is that the desired result?
.

その他の回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by