필터 지우기
필터 지우기

How do I reflex a plot?

조회 수: 1 (최근 30일)
Mikel Gonzalez Bribiesca
Mikel Gonzalez Bribiesca 2021년 11월 24일
답변: Star Strider 2021년 11월 24일
Okay so I got the next code which displays the graph shown below.
It is the code for potential and field lines in a capacitor, or in this case, for the right side of the capacitor.
How can I plot it for it to show both left and right side? So the same lines would show on both sides.
Thank you so much
u = -8:1:1.3;
for v = -pi:pi/10:pi
x = 1 + u + exp(u)*cos(v);
y = v + exp(u)*sin(v);
plot(x,y,'r')
hold on
end
hold on
v2 = -pi:pi/100:pi ;
for u2 = -8:.25:1.3
x = 1 + u2 + exp(u2)*cos(v2);
y = v2 + exp(u2) * sin(v2);
plot(x,y,'b')
hold on
end

답변 (1개)

Star Strider
Star Strider 2021년 11월 24일
Try this —
u = -8:1:1.3;
v = -pi:pi/10:pi;
for k = 1:numel(v)
x{k,1} = 1 + u + exp(u)*cos(v(k));
y{k,1} = v(k) + exp(u)*sin(v(k));
plot(x{k,1},y{k,1},'r')
hold on
end
hold on
v2 = -pi:pi/100:pi ;
u2 = -8:.25:1.3;
for k = 1:numel(u2)
x{k,2} = 1 + u2(k) + exp(u2(k))*cos(v2);
y{k,2} = v2 + exp(u2(k)) * sin(v2);
plot(x{k,2},y{k,2},'b')
hold on
end
maxx = max(cellfun(@(x)max(x(:)),x(:,2))); % Add Or Subtract From This Value To Adjust Spacing
x1r = 2*maxx - cell2mat(x(:,1));
y1r = cell2mat(y(:,1));
x2r = 2*maxx - cell2mat(x(:,2));
y2r = cell2mat(y(:,2));
plot(x1r.', y1r.', '-r')
plot(x2r.', y2r.', '-b')
hold off
.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by