Solving an equation multiple times using a for loop

3 views (last 30 days)
Hello,
I am trying to solve the following equation for time (t) using different air temperatures. Matlab says that the solution is 0*1 empty double column vector!
Thank you for your help.
clear all
clc
x=1
for T_a_amb=[270.928:0.01:272.594] %ambient air temperature
syms t
a = -4/(T_a_amb-277);
b = 5.948e-5;
c = 0.00771;
eqn = 1-(exp(b*t)*(1-erf(c*sqrt(t)))) - a== 0; %
solution = double(vpasolve(eqn,t,[0,1]))
solmate(x,1) = T_a_amb;
solmat(x,2) = solution;
x = x+1
end
  1 Comment
Bob Thompson
Bob Thompson on 30 Apr 2019
Is the vpasolve coming up with a set of answers? That would be my first thought to check.

Sign in to comment.

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!