i have to read an exel file which has iterations and cl/cd/cm and make a loop for plotting subplots for cl/cd/cm vs iteration which has different angle of attacks.
1 view (last 30 days)
Show older comments
this is the code i am currently using.
dataset=readtable('output2''.xlsx');
dataset.Properties.VariableNames(1) = "iteration1";
dataset.Properties.VariableNames(2) = "cl";
dataset.Properties.VariableNames(3) = "iteration2";
dataset.Properties.VariableNames(4) = "cd";
dataset.Properties.VariableNames(5) = "iteration3";
dataset.Properties.VariableNames(6) = "cm";
y1=dataset.iteration1;
y2=dataset.cl;
y3=dataset.cd;
y4=dataset.cm;
subplot(3,1,1);
plot(y1,y2,'r--');
subplot(3,1,2);
plot(y1,y3,'b--');
subplot(3,1,3);
plot(y1,y4,'g--');
1 Comment
Answers (1)
Star Strider
on 26 Oct 2023
If you need to do those plots in a loop, and assuming that the table variable names are (in order): iteration1, cl, iteration2, cd, iteration3, cm, set the loop up as:
figure
for k = 1:2:6
subplot(3,1,ceil(k/2))
plot(dataset{:,k}, dataset{:,k+1})
end
Add other plot enhaancements as necessary.
.
0 Comments
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!