Adding Legend to a multiple graph within a loop
이전 댓글 표시
Hello there!
I am writing a short code for plotting data from COMSOL.
These data concern the attenuation loss of a bent loss for fifteen curvature radii against twenty-seven wavelength forming a 405 X 3 matrix. I need to overlay each plot within the same image and to label each one by the relative curvature radius. I succeeded to complete the first part of the task but I really cannot add the legends. Could anyone please help me?
clear all
close all
clc
hold on
data=dlmread('data.txt')
for i= 1:27:378
for j = 28:27:405
for k=1:15
txt = ['X = ',num2str(k)];
plot(data(i:j,2),data(i:j,3), 'DisplayName' ,txt)
end
end
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Legend에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!