【发布时间】:2018-11-06 03:27:14
【问题描述】:
我想添加一些内容以使我的相图更易于理解。不过,我什么也找不到(我找到了这个 https://se.mathworks.com/help/matlab/ref/colorspec.html https://se.mathworks.com/matlabcentral/fileexchange/11611-linear-2d-plot-with-rainbow-color https://se.mathworks.com/help/symbolic/mupad_ref/linecolortype.html ) 但这不是我需要的。
我真的很想看到相像线的颜色根据它是在模拟开始还是在模拟结束时发生变化。
我发现这个想法看起来很棒:
我完全不明白他做了什么(我想代码写在这里: https://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/) 但是,如果我可以绘制一个颜色随时间变化的单线函数,那就太好了。此外,如果像图片上的那样,我可以在右边有一个刻度:那就太棒了。
所以现在,我有那个:
data = readtable('test.txt');
figure('Name','Phase' , 'units','normalized','outerposition',[(8/100) (0.3- 16/100) 0.5 0.7]);
hold on
plot(data{:,2},data{:,3}, 'k.', 'LineWidth',1.5 );
plot(data{:,4},data{:,5}, 'r.', 'LineWidth',1.5 );
xL = xlim;
yL = ylim;
line([0 0], yL); %x-axis
line(xL, [0 0]); %y-axis
title(['Phase portrait'])
xlabel('f')
ylabel('f '' ')
hold off
我在 .txt 文件中读取函数的值,然后绘制第 2/3 列和第 4/5 列。第一列是时间演变。
你有什么想法吗:)?
谢谢!
【问题讨论】: