Anonymous function outputs to table

2 次查看(过去 30 天)
doublingtime = @(q) log(2)/log(1+q);
dt = doublingtime(q);
This is the relevant code. I want to make a 25x2 table which shows q values and the corresponding dt values. I want q to go from 0 to 0.25 with a step of 0.01 each time. I've tried all sorts of method to make it work, but im stuck.

采纳的回答

KSSV
KSSV 2019-11-11
q = 0:0.01:0.25 ;
doublingtime = @(q) log(2)./log(1+q);
dt = doublingtime(q);
T = table(q,dt)
  1 个评论
ingeik
ingeik 2019-11-11
q = 0:0.01:0.25 ;
doublingtime = @(q) log(2)./log(1+q);
dt = doublingtime(q);
T = table(q',dt', 'VariableNames', {'q', 'dt'});
disp(T)
Thank you. After just tweaking your answer a little bit, I got it to work the way I wanted!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by