2013-03-31 51 views
0

我有一些matlab代碼是爲繪圖中的多行繪製而創建的。但是,似乎並沒有像我希望的那樣在文字的末尾畫出文字。有沒有人有一種更簡單的方法,爲什麼它可能不工作。在matlab中繪製多行文字行尾文字

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); 

回答

0

嘗試

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

你也可能要更改劇情

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