How do you match the width of figures in a tiledlayout when using axis equal?
There are 4 figures combined in a tiledlayout. The respective ratio of their dimensions is 1:1, using axis equal. However, their widths do not match. How can this be adapted? See the MWE:
clear variables; close all; clc;
tiledlayout(4,1)
amplitudes = [200e-3,50e-3,10e-3,200e-6];
wavelenghts = [50,500e-3,50e-3,500e-6];
for i = 1:numel(amplitudes)
nexttile
axis equal
x = 0:(wavelenghts(i)/100):(wavelenghts(i)/2);
y = amplitudes(i)*(1-cospi(2*1/wavelenghts(i)*x));
hold on
area(-x,y)
area(x,y)
xlim([-1 1]*wavelenghts(i)/2)
ylim([0 max(y)])
clear x y;
endThere are 4 figures combined in a tiledlayout. The respective ratio of their dimensions is 1:1, using axis equal. However, their widths do not match. How can this be adapted? See the MWE:
clear variables; close all; clc;
tiledlayout(4,1)
amplitudes = [200e-3,50e-3,10e-3,200e-6];
wavelenghts = [50,500e-3,50e-3,500e-6];
for i = 1:numel(amplitudes)
nexttile
axis equal
x = 0:(wavelenghts(i)/100):(wavelenghts(i)/2);
y = amplitudes(i)*(1-cospi(2*1/wavelenghts(i)*x));
hold on
area(-x,y)
area(x,y)
xlim([-1 1]*wavelenghts(i)/2)
ylim([0 max(y)])
clear x y;
end There are 4 figures combined in a tiledlayout. The respective ratio of their dimensions is 1:1, using axis equal. However, their widths do not match. How can this be adapted? See the MWE:
clear variables; close all; clc;
tiledlayout(4,1)
amplitudes = [200e-3,50e-3,10e-3,200e-6];
wavelenghts = [50,500e-3,50e-3,500e-6];
for i = 1:numel(amplitudes)
nexttile
axis equal
x = 0:(wavelenghts(i)/100):(wavelenghts(i)/2);
y = amplitudes(i)*(1-cospi(2*1/wavelenghts(i)*x));
hold on
area(-x,y)
area(x,y)
xlim([-1 1]*wavelenghts(i)/2)
ylim([0 max(y)])
clear x y;
end matlab, figure, tiledlayout, axis euqal MATLAB Answers — New Questions