简体   繁体   English

在matlab的行尾绘制多行文本

[英]plotting multiple lines with text at end of line in matlab

I have some matlab code I have created for plotting multiple lines in the plot. 我有一些matlab代码,用于在图中绘制多条线。 However it does not seem to plot the text at the end of the line like I was hoping for. 但是,它似乎并没有像我希望的那样在行尾绘制文本。 Does anyone have an idea of a way to make easier and why it might not be working. 有没有人想过一种使事情变得容易的方法,以及为什么它可能行不通。

format long;
options = optimset('TolFun',1e-12);
vfb = -0.9;
fT= 0.026;
fF = 0.4591431;
gamma = 0.2377589;
datafile = fopen('quiz3p2bresults.text','w');
if datafile == -1
    error('Error opening data file!');
end


fprintf(datafile, '%s\t %s\n', 'Vgb', 'PSIL')
vgb = 1:0.5:2;
vgb = vgb';
vdb = 0:0.1:1.5;
vdb = repmat(vdb,3,1);
eqn = @(psiL) (vgb-vfb-gamma*(sqrt((psiL-vdb)/fT)));
result = fsolve(eqn,vgb,options);
plot(vdb,result(1,:),'r',vdb,result(2,:),'y',vdb,result(3,:),'g');
text(max(vdb), max(result), num2str(vgb));


fclose(datafile);

Try 尝试

text(max(vdb), result( : , max(size(result)) ), num2str(vgb));

You might also want to change the plot to 您可能还想将情节更改为

plot(vdb(1,:),result(1,:), ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM