How can I get plot for second txt file of the following attached code

1 回表示 (過去 30 日間)
MG
MG 2020 年 10 月 17 日
回答済み: Nagasai Bharat 2020 年 10 月 20 日
clc
clear all
close all
for R = 1:2
filename = ['Save','_','Polar','_',num2str(R),'.txt']
%% READ DATA FILE: Polar
opt = detectImportOptions(filename,'NumHeaderLines',11); % Number of header lines which will be ignored
D = readtable(filename, opt);
Alpha =D{:,1};
CL =D{:,2};
CD =D{:,3};
CDp =D{:,4};
CM =D{:,5};
%% Plot CL vs Alpha NACA 2408
set(gcf,'Color','White');
set(gca,'FontSize',12);
%PlotAxisAtOrigin(Alpha,CL,'b-o','LineWidth',1.5);
plot(Alpha,CL,'b-o','LineWidth',1.5);
axis([-10 25 -1 3]);
xlabel('AOA');
ylabel('Lift Coefficient');
title('CL vs AOA')
grid on
end

回答 (1 件)

Nagasai Bharat
Nagasai Bharat 2020 年 10 月 20 日
Hi,
From my understanding you are trying to create two plots in a single figure using a for loop. In order to do that you need to use the command "hold on" after the plot and end your script with hold off when you do not want to have more plots in that figure.
The following documentation would guide you through it.

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by