matlab2tikz
은 라텍스 패키지 pgfplots
을 기반으로 라텍스 코드를 생성하고 있습니다. 이 패키지의 작업을 이해하는 것은 Matlab과 유사하기 때문에 매우 쉽습니다.
그래서 왜 귀찮게 항상 matlab2tikz
이 당신을 위해 일하게합니까? 반복해서 결과에 만족하지 않을 것이기 때문에. 처음부터 pgfplots-code를 쓰고, 은 Matlab에서 데이터을로드하기 만하면됩니다. 여기
내가 라텍스 준비 텍스트 파일을 만드는 데 쓴 편리한 기능입니다 : w G0_mag G0_phase GF_mag GF_phase
10.000000 40.865743 -169.818991 0.077716 -0.092491
10.309866 40.345290 -169.511901 0.082456 -0.101188
10.629333 39.825421 -169.196073 0.087474 -0.110690
10.958700 39.306171 -168.871307 0.092787 -0.121071
11.298273 38.787575 -168.537404 0.098411 -0.132411
에서 : 예를 들어 보데 다이어그램의 경우, 다음과 같이 할 수
function output = saveData(filename, header, varargin)
in = varargin;
numCols = numel(in);
if all(cellfun(@isvector, in))
maxLength = max(cellfun(@numel, in));
output = cell2mat(cellfun(@(x) [x(:); NaN(maxLength - numel(x) + 1,1)],in,'uni',0));
fid = fopen(filename, 'w');
fprintf(fid, [repmat('%s\t',1,numCols),'\r\n'], header{:});
fclose(fid);
dlmwrite(filename,output,'-append','delimiter','\t','precision','%.6f','newline', 'pc');
else
disp('saveData: only vector inputs allowed')
end
end
tikzpicture
그러면 파일을로드 할 수 있습니다.
\pgfplotstableread[skip first n=1]{mydata.txt}\mydata
변수 \mydata
을 사용할 수 있습니다.
이제 pfgplots 데이터를 플로팅하는 방법을 확인하십시오. 직접 \thisrowno{0}
(혼란, 내가 아는)하여 텍스트 파일의 열을 액세스하는 위치 당신은 기본 플롯 명령 \addplot
\addplot table [x expr= \thisrowno{0}, y expr= \thisrowno{3} ] from \mydata;
을 찾을 수 있습니다.
많은 데이터 포인트를 사용하여 문제에 대해서 : pgfplots 물건을 빠르게 키 each nth point={ ... }
을 제공합니다. 그러나 나는 Matlab에서 이미 데이터를 필터링/데시 메이트하려고합니다. 다른 방법으로도 가능합니다. 데이터 포인트가 거의 없다면 smooth
키를 눌러 부드럽게 만듭니다.