incomplete command in TeX text string
1 回表示 (過去 30 日間)
古いコメントを表示
function []=printpowerf(x,y,z)
%this function print a power function onto the plot
%x and y are coordinates about where you want to put the graph
%z is the the coefficients containing alpha and beta of the power fucntion.
string1=['y=',z(1),'*x^',z(2)];
text(x,y,string1);
end
I'm trying to create a function to help me draw equations on plots. Codes above doesn't draw z values out and command window says incomplete command in TeX text string
0 件のコメント
回答 (1 件)
Walter Roberson
2016 年 2 月 18 日
string1 = sprintf('y = %f * x^{%f}', z(1), z(2))
Remember, using [] concatenation of a numeric value against a string is like using char() on the numeric values, and that means "look in the Unicode tables" rather than "format a number to be printable". Like char(10) does not mean '10', it means Unicode character #10, newline.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!