How to plot both graphs for the given condition, kindely help!

A=2;
thetap=pi/2;
d=6;
z=0:0.1:6;
if (0 < z <= d/2);
y=2*atan(exp(z*sqrt(A)+thetap))-pi/2;
else z > d/2
y=2*atan(exp(-(z-d)*sqrt(A)+thetap))-pi/2;
end
plot(y,z)

 採用された回答

Voss
Voss 2022 年 7 月 15 日
A=2;
thetap=pi/2;
d=6;
z=0:0.1:6;
y = zeros(size(z));
idx = 0 <= z & z <= d/2; % I imagine you mean 0 <= z, rather than 0 < z
y(idx) = 2*atan(exp(z(idx)*sqrt(A)+thetap))-pi/2;
y(~idx) = 2*atan(exp(-(z(~idx)-d)*sqrt(A)+thetap))-pi/2;
plot(y,z)

2 件のコメント

DEEPAK KARARWAL
DEEPAK KARARWAL 2022 年 7 月 19 日
thank you sir
Voss
Voss 2022 年 7 月 19 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

リリース

R2021b

タグ

質問済み:

2022 年 7 月 15 日

コメント済み:

2022 年 7 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by