フィルターのクリア

if A=1:0.1:10 and B=1:4,T=exp(A/B) , is there anyway to plot a graph of T against A?

1 回表示 (過去 30 日間)
Austin
Austin 2013 年 10 月 29 日
編集済み: Sean de Wolski 2013 年 10 月 29 日
if A=1:0.1:10 and B=1:4, T=exp(A/B) , since they are of matrices of different sizes, is there anyway to plot a graph of T against A such as using for loops?

回答 (2 件)

sixwwwwww
sixwwwwww 2013 年 10 月 29 日
編集済み: sixwwwwww 2013 年 10 月 29 日
Dear Austin, you can do it as follows:
A = 1:0.1:10;
B = linspace(1, 4, numel(A))
T=exp(A./B);
plot(A, T), xlabel('A'), ylabel('T')
I hope it helps. Good luck!

Sean de Wolski
Sean de Wolski 2013 年 10 月 29 日
編集済み: Sean de Wolski 2013 年 10 月 29 日
Use bsxfun to do the division. Here is a small example:
A = 1:0.1:10;
B = 1:4;
T = exp(bsxfun(@rdivide,A,B'));
plot(A,T)
Note, four lines have been drawn, the plot it just scaled to the very large values so the rest appear lumped at the bottom.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by