Change y-axis values of list of MatLab plots

3 visualizzazioni (ultimi 30 giorni)
Kristan Otten
Kristan Otten il 22 Dic 2020
Commentato: Walter Roberson il 22 Dic 2020
filename='FRAP51';
frapFrame=6;
%%%%
T=readtable(filename);
y=(T{:,2}-min(T{:,2}))/(max(T{:,2})-min(T{:,2}));
x=1:1:(size(T,1));
x=x';
xfit=x(frapFrame:end);
yfit=y(frapFrame:end);
figure(1);
subplot(1,2,1);
plot(x,y);
[xData, yData] = prepareCurveData( xfit, yfit );
% Set up fittype and options.
ft = fittype( 'a*(1-exp(-b*x))', 'independent', 'x', 'dependent', 'y' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.8 0.1];
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
subplot(1,2,2);
h = plot( fitresult, xData, yData );
legend( h, 'yfit vs. xfit', 'a*(1-exp(-b*x)) fit', 'Location', 'NorthEast' );
amplitud=fitresult.a;
tau=fitresult.b;
r2=gof.rsquare;
fprintf(sprintf('%s; %f ; %f ; %f \n', filename, amplitud, tau, r2));
I have used this code to create plots out of .csv data files. However, the y-axis of the plot with the trendline automatically scales, this can be changed by adding: ylim([0 1]); under subplot but this would be time-consuming and I would have to do everything over again.
So, I was wondering if there's is a way to change the y-axis for a lot of MatLab figures in the same folder?

Risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by