why this function is not plotting?
조회 수: 1 (최근 30일)
이전 댓글 표시
a =5;
T = 2E3;
Z = linspace(0,0.1,0.01);
U = (1+2.*Z)./(2.*a.*T);
plot(Z,U)
댓글 수: 0
답변 (1개)
Star Strider
2022년 7월 21일
Look t the linspace result —
a =5;
T = 2E3;
Z = linspace(0,0.1,0.01)
U = (1+2.*Z)./(2.*a.*T);
plot(Z,U)
a =5;
T = 2E3;
Z = linspace(0,0.1,150) % 'linspace' Now Produces A Vector
U = (1+2.*Z)./(2.*a.*T);
plot(Z,U)
.
댓글 수: 3
Star Strider
2022년 7월 21일
Shading between them is straightforward —
% clc
% clear all
a =5;
T = 2E3;
Z = linspace(0,0.1,150);
U = (1+2.*Z)./(2.*a.*T);
V = (a.*Z)./(1+2.*Z);
Lv = Z>0;
UL10 = log10(U(Lv));
VL10 = log10(V(Lv));
figure
patch([Z(Lv) flip(Z(Lv))], [UL10 flip(VL10)], 'g', 'FaceAlpha',0.25)
hold on
plot(Z,log10(U))
plot(Z,log10(V))
hold off
grid on
The use of ‘Lv’ here is to avoid using values of ‘Z’ equal to 0 becausse the log of 0 in any base is -Inf, and the patch function will not work with non-finite values.
.
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!