MATLAB Answers

ingeik
0

Anonymous function outputs to table

Asked by ingeik
on 11 Nov 2019 at 4:10
Latest activity Commented on by ingeik
on 11 Nov 2019 at 4:40
Accepted Answer by KSSV
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.

  0 Comments

Sign in to comment.

1 Answer

Answer by KSSV
on 11 Nov 2019 at 4:25
 Accepted Answer

q = 0:0.01:0.25 ;
doublingtime = @(q) log(2)./log(1+q);
dt = doublingtime(q);
T = table(q,dt)

  1 Comment

ingeik
on 11 Nov 2019 at 4:40
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!

Sign in to comment.