Solve a linear system of equation using ODE45 in MATLAB - function

I have written a function plus a script to determine the variables. My variables name are "S E I1 I2 R Q H" which I named them in my function as x(1) to x(7). The total number of population equals to N which also equals to x(1)+x(2)+x(3)+x(4)+x(5). The problem is that when I try to run the script MATLAB gives me error and can not solve the linear system of ordinary differential equations. The worse problem is that MATLAB does not tell me where I'm wrong. It just tell me that the error comes from the eight line of my function. Can anyone help me with it ?
function Variables_rate = COVID_FUN(t,x) %#ok
NV = 7; % Number of Variables
global beta1 beta2 kessi ro1 ro2 alpha theta1 theta2 gamma1 gamma2 say phi lambda delta
% The Whole Number of community (N) equals to : N = S + E + I + R
N = x(1) + x(2) + x(3) + x(4) + x(5); % Total Number of people
%% This function will Model the COVID-19 Dynamical System Based on input Variables which are as follows :
% S: Suceptible Class corrosponds to {x1}
% E : Exposed Corrosponds to {x2}
% I1 : Infectious without intervention Corrosponds to {x3}
% I2 : Infectious with intervention corrosponds to {x4}
% R : Recovered corrosponds to {x5}
% Q : Quarantined corrosponds to {x6}
% H : Hospitalized corrosponds to {x7}
%% Model The Dynamic of the System with Differential Equations
Variables_rate = zeros(NV,1);
Variables_rate(1) = (-x(1)./N)*(beta1*x(3)+beta2*x(4)+kessi*x(2))+ro1*x(6)-ro2*x(1)+alpha*x(5); % Sdot
Variables_rate(2) = (x(1)./N)*(beta1*x(3)+beta2*x(4)+kessi*x(2))-theta1*x(2)-theta2*x(2); % Edot
Variables_rate(3) = theta1*x(2)-gamma1*x(3); % I1dot
Variables_rate(4) = theta2*x(2)-gamma2*x(4)-say*x(4)+lambda*(delta+x(6)); % I2dot
Variables_rate(5) = gamma1*x(3)+gamma2*x(4)+phi*x(7)-alpha*x(5); % Rdot
Variables_rate(6) = say*x(4)-phi*x(7); % Qdot
Variables_rate(7) = delta+ro2*x(1)-lambda*(delta+x(6))-ro1*x(6); % Hdot
end
Also the following is my main script :
clc;clear;close all;
% { COVID-19 Main Script Based on the written function }
global beta1 beta2 kessi ro1 ro2 alpha theta1 theta2 gamma1 gamma2 phi lambda delta say
%% According to TABLE 5 the Values of the Global Parameters are as follows :
beta1 = 1.0538*1e-1; % Contact rate of transmission per contact with infected class
beta2 = beta1; % Infection rate of transmission per contact with infected class
kessi = 1.6221*1e-1; % Probability of transmission per contact from exposed individuals
ro1 = 2.8133*1e-3; % Transition rate of quarantined exposed between the quarantined infected class and wider community
ro2 = 1.2668*1e-1; % Transition rate of quarantined exposed between the quarantined infected class and wider community
alpha = 1.2048*1e-4; % Temporary Immunity Rate
theta1 = 9.5*1e-4; % Transition rate of exposed individuals to the infected class
theta2 = 3.5412*1e-2; % Transition rate of exposed individuals to the infected class
gamma1 = 8.5*1e-3; % Recovery rate of symptomatic Infected Individuals to recovered
gamma2 =1.0037*1e-3; % Recovery rate of symptomatic Infected Individuals to recovered
say = 0.291; % Rate of Infectious with symptoms Hospitalized
phi = 0.0107; % Recovered rate of Quarantined infected individuals
lambda = 9.4522*1e-2; % Recovered rate of Quarantined Class to the recovered class
delta = 10; % External Input from the foreign countries
%% Time Vector and Initial Conditions
t = linspace(0,5,5);
Ics = [59717.71 5077 7.29 729 32 4711 658]';
%% Solve the Linear System Using ODE45 function
[~,States] = ode45(#(t,x)COVID_FUN,t,Ics)

Related

Octave: invalid call to a script

I am trying to call to a script, and I am getting an error message. Please help.
The following is what I am trying to run in Octave:
%%% May 23, 2016
%%% Potential Fields for Robot Path Planning
%
%
% Initially proposed for real-time collision avoidance [Khatib 1986].
% Hundreds of papers published on APF
% A potential field is a scalar function over the free space.
% To navigate, the robot applies a force proportional to the
% negated gradient of the potential field.
% A navigation function is an ideal potential field
clc
close all
clear
%% Defining environment variables
startPos = [5,5];
goalPos = [90, 95];
obs1Pos = [50, 50];
obsRad = 10;
goalR = 0.2; % The radius of the goal
goalS = 20; % The spread of attraction of the goal
obsS = 30; % The spread of repulsion of the obstacle
alpha = 0.8; % Strength of attraction
beta = 0.6; % Strength of repulsion
%% Carry out the Potential Field Math as follows:
u = zeros(100, 100);
v = zeros(100, 100);
testu = zeros(100, 100);
testv = zeros(100, 100);
for x = 1:1:100
for y = 1:1:100
[uG, vG] = GoalDelta(x, y, goalPos(1), goalPos(2), goalR, goalS, alpha);
[uO, vO] = ObsDelta(x, y, obs1Pos(2), obs1Pos(1), obsRad, obsS, beta);
xnet = uG + uO;
ynet = vG + vO;
vspeed = sqrt(xnet^2 + ynet^2);
theta = atan2(ynet,xnet);
u(x,y) = vspeed*cos(theta);
v(x,y) = vspeed*sin(theta);
% hold on
end
end
%%
[X,Y] = meshgrid(1:1:100,1:1:100);
figure
quiver(X, Y, u, v, 3)
%% Defining the grid
% Plotting the obstacles
circles(obs1Pos(1),obs1Pos(2),obsRad, 'facecolor','red')
axis square
hold on % Plotting start position
circles(startPos(1),startPos(2),2, 'facecolor','green')
hold on % Plotting goal position
circles(goalPos(1),goalPos(2),2, 'facecolor','yellow')
%% Priting of the path
currentPos = startPos;
x = 0;
while sqrt((goalPos(1)-currentPos(1))^2 + (goalPos(2)-currentPos(2))^2) > 1
tempPos = currentPos + [u(currentPos(1),currentPos(2)), v(currentPos(1),currentPos(2))]
currentPos = round(tempPos)
hold on
plot(currentPos(1),currentPos(2),'-o', 'MarkerFaceColor', 'black')
pause(0.5)
end
The following is the error message I am getting:
error: invalid call to script C:\Users\MyComputer\Downloads\circles.m
error: called from
circles
ECE8743_PotentialFields_Obstacle_1 at line 59 column 1
>>
Here is circles.m:
function [ h ] = circles(x,y,r,varargin)
% h = circles(x,y,r,varargin) plots circles of radius r at points x and y.
% x, y, and r can be scalars or N-D arrays.
%
% Chad Greene, March 2014. Updated August 2014.
% University of Texas Institute for Geophysics.
%
%% Syntax
% circles(x,y,r)
% circles(...,'points',numberOfPoints)
% circles(...,'rotation',degreesRotation)
% circles(...,'ColorProperty',ColorValue)
% circles(...,'LineProperty',LineValue)
% h = circles(...)
%
%% Description
%
% circles(x,y,r) plots circle(s) of radius or radii r centered at points given by
% x and y. Inputs x, y, and r may be any combination of scalar,
% vector, or 2D matrix, but dimensions of all nonscalar inputs must agree.
%
% circles(...,'points',numberOfPoints) allows specification of how many points to use
% for the outline of each circle. Default value is 1000, but this may be
% increased to increase plotting resolution. Or you may specify a small
% number (e.g. 4 to plot a square, 5 to plot a pentagon, etc.).
%
% circles(...,'rotation',degreesRotation) rotates the shape by a given
% degreesRotation, which can be a scalar or a matrix. This is useless for
% circles, but may be desired for polygons with a discernible number of corner points.
%
% circles(...,'ColorProperty',ColorValue) allows declaration of
% 'facecolor' or 'facealpha'
% as name-value pairs. Try declaring any fill property as name-value pairs.
%
% circles(...,'LineProperty',LineValue) allows declaration of 'edgecolor',
% 'linewidth', etc.
%
% h = circles(...) returns the handle(s) h of the plotted object(s).
%
%
%% EXAMPLES:
%
% Example 1:
% circles(5,10,3)
%
% % Example 2:
% x = 2:7;
% y = [5,15,12,25,3,18];
% r = [3 4 5 5 7 3];
% figure
% circles(x,y,r)
%
% % Example 3:
% figure
% circles(1:10,5,2)
%
% % Example 4:
% figure
% circles(5,15,1:5,'facecolor','none')
%
% % Example 5:
% figure
% circles(5,10,3,'facecolor','green')
%
% % Example 6:
% figure
% h = circles(5,10,3,'edgecolor',[.5 .2 .9])
%
% % Example 7:
% lat = repmat((10:-1:1)',1,10);
% lon = repmat(1:10,10,1);
% r = .4;
% figure
% h1 = circles(lon,lat,r,'linewidth',4,'edgecolor','m','facecolor',[.6 .4 .8]);
% hold on;
% h2 = circles(1:.5:10,((1:.5:10).^2)/10,.12,'edgecolor','k','facecolor','none');
% axis equal
%
% % Example 8: Circles have corners
% This script approximates circles with 1000 points. If all those points
% are too complex for your Pentium-II, you can reduce the number of points
% used to make each circle. If 1000 points is not high enough resolution,
% you can increase the number of points. Or if you'd like to draw
% triangles or squares, or pentagons, you can significantly reduce the
% number of points. Let's try drawing a stop sign:
%
% figure
% h = circles(1,1,10,'points',8,'color','red');
% axis equal
% % and we see that our stop sign needs to be rotated a little bit, so we'll
% % delete the one we drew and try again:
% delete(h)
% h = circles(1,1,10,'points',8,'color','red','rot',45/2);
% text(1,1,'STOP','fontname','helvetica CY',...
% 'horizontalalignment','center','fontsize',140,...
% 'color','w','fontweight','bold')
%
% figure
% circles([1 3 5],2,1,'points',4,'rot',[0 45 35])
%
%
% TIPS:
% 1. Include the name-value pair 'facecolor','none' to draw outlines
% (non-filled) circles.
%
% 2. Follow the circles command with axis equal to fix distorted circles.
%
% See also: fill, patch, and scatter.
%% Check inputs:
assert(isnumeric(x),'Input x must be numeric.')
assert(isnumeric(y),'Input y must be numeric.')
assert(isnumeric(r),'Input r must be numeric.')
if ~isscalar(x) && ~isscalar(y)
assert(numel(x)==numel(y),'If neither x nor y is a scalar, their dimensions must match.')
end
if ~isscalar(x) && ~isscalar(r)
assert(numel(x)==numel(r),'If neither x nor r is a scalar, their dimensions must match.')
end
if ~isscalar(r) && ~isscalar(y)
assert(numel(r)==numel(y),'If neither y nor r is a scalar, their dimensions must match.')
end
%% Parse inputs:
% Define number of points per circle:
tmp = strcmpi(varargin,'points')|strcmpi(varargin,'NOP')|strcmpi(varargin,'corners')|...
strncmpi(varargin,'vert',4);
if any(tmp)
NOP = varargin{find(tmp)+1};
tmp(find(tmp)+1)=1;
varargin = varargin(~tmp);
else
NOP = 1000; % 1000 points on periphery by default
end
% Define rotation
tmp = strncmpi(varargin,'rot',3);
if any(tmp)
rotation = varargin{find(tmp)+1};
assert(isnumeric(rotation)==1,'Rotation must be numeric.')
rotation = rotation*pi/180; % converts to radians
tmp(find(tmp)+1)=1;
varargin = varargin(~tmp);
else
rotation = 0; % no rotation by default.
end
% Be forgiving if the user enters "color" instead of "facecolor"
tmp = strcmpi(varargin,'color');
if any(tmp)
varargin{tmp} = 'facecolor';
end
%% Begin operations:
% Make inputs column vectors:
x = x(:);
y = y(:);
r = r(:);
rotation = rotation(:);
% Determine how many circles to plot:
numcircles = max([length(x) length(y) length(r) length(rotation)]);
% Create redundant arrays to make the plotting loop easy:
if length(x)<numcircles
x(1:numcircles) = x;
end
if length(y)<numcircles
y(1:numcircles) = y;
end
if length(r)<numcircles
r(1:numcircles) = r;
end
if length(rotation)<numcircles
rotation(1:numcircles) = rotation;
end
% Define an independent variable for drawing circle(s):
t = 2*pi/NOP*(1:NOP);
% Query original hold state:
holdState = ishold;
hold on;
% Preallocate object handle:
h = NaN(size(x));
% Plot circles singly:
for n = 1:numcircles
h(n) = fill(x(n)+r(n).*cos(t+rotation(n)), y(n)+r(n).*sin(t+rotation(n)),'',varargin{:});
end
% Return to original hold state:
if ~holdState
hold off
end
% Delete object handles if not requested by user:
if nargout==0
clear h
end
end
What am I doing wrong here? How do I correct this error? I am rather new to Octave and Matlab, so any help is greatly appreciated.
this is the first post after pasting the error so maybe it'll help anyone later:
in my case pasting the script into a function worked out!
function retval = name_of_script(parametres)
%your script
endfunction

Where is the error in my below code for approximate solution of poisson boundary value problem?

I have to solve the following boundary value problem which is
also it is defined in my Matlab code below, but my code doesn't work. I mean I didn't get the approximate solution of my system.
I want to know where is the problem in my code or just the version of matlab that I have can't compile the kind of function I have used , Thanks
Explanation of method I have used : I have used the finite element method or what we called Galerkin Method based on investigation about assembly matrix and stiffness matrix. I have multiplied the system by weight function which satisfies the boundary condition then I have integrated over elements (integration of elementary matrix over the range ]-1,1[). I have four elementary matrix. For more information about that Method I used please check this paper(page:6,7,8)
Note The error I have got upon the compilation of my code is
The current use of "MatElt2Nd" is inconsistent with it previous use or definition in line 7
Code
function [U] = EquaDiff2(n)
% ----------------------------------
% -d²u/dx² + 6*u = (-4*x^2-6)exp(x^2)
% u(-1) = 0 u(1)= 0
%----------------------------------
function [Ke, Fe] = MatElt2Nd(x1,x2)
% déclaration de la fonction,
% function of computing matrix and elementary matrix (assembly matrix)
% ----------------------------------
x = [-1:2/n:1]'; % modification d1 of bound d’intégration
K = zeros(n+1) ;
F = zeros(n+1,1) ;
for i = 1:n
j = i+1;
t = [i j];
x1 = x(i);
x2 = x(j);
[Ke,Fe] = MatElt2Nd(x1,x2);
K(t,t) = K(t,t) + Ke;
F(t) = F(t) + Fe;
end;
K(1,:) = [];
K(:,1) = [];
F(1) = [];
U = K\F;
U = [0.0;U];
t = 0:0.01:1;
return
%-------------------------------------------
% calculation of matrix Ke and vector Fe
%-------------------------------------------
function [Ke,Fe] = MatElt2Nd0(x1,x2)
% NEWly named nested function is introduced
Ke1 = 1/(x2-x1)*[ 1 -1 % no modification done
-1 1 ] ; % essentiellement que les matrices
Ke2 =(x2-x1)* [ 2 1 % élémentaires
1 2 ] ;
N = [(x-x2)/(x1-x2) (x-x1)/(x2-x1)] % function of form
Fe =simple( int(N' * (-4*x^2-6)*exp(x^2) , x, x1, x2) ) % vecteur Fe ;
Ke = Ke1 + 6*Ke2 ;
return
Edit I have got a general code for that but I can't do changes in the general code to solve my system , Any help ?
General Code
% au'(x)+bu"(x)=0 for 0<=x<=d
% BC: u(0)=0 and u(d)=h
%==============================================================
% ======Example======
% Finding an approximate solution to the following BVP using 4 elements of
% equal length.
% u'(x)-u"(x)=0 : 0<=x<=1
% BC: u(0)=0 and u(1)=1
% Solution:
% >> Galerkin(4,1,-1,1,1)
% ==============================================================
% The output of this program is
% 1- The approximate solution (plotted in blue)
% 2- The exact solution (plotted in red)
% 3- The percentage error (plotted in magenta)
%=======================Program Begin==========================
function Galerkin(ne1,a,b,d,h) % Declare function
clc % Clear workspace
% Define the Coefficients of the exact solution
% The Exact solution is : u(x)=C1+C2*exp(-ax/b)
% where C2=h/(exp(-a*d/b)-1)and C1=-C2
C2=h/((exp(-a*d/b))-1);
C1=-C2;
% Define element length
le = d/ne1;
% Define x matrix
x = zeros (ne1+1,1); %
for i=2:ne1 +1
x(i,1) = x(i-1,1)+le;
end
% K1 matrix corresponding to the diffusion term (u"(x))
K1 = (b/le) * [1,-1;-1,1]
% K2 matrix corresponding to the convection term (u'(x))
K2 = a*[-1/2 1/2;-1/2 1/2]
% Element stiffness Matrix
Ke = K1+K2
% Global stiffness matrix
%********************Begin Assembly***************************
k = zeros(ne1+1);
for i=1:ne1+1
for j=1:ne1 +1
if (i==j)
if(i==1)
k(i,j)=Ke(1,1);
elseif(i==ne1+1)
k(i,j)=Ke(2,2);
else
k(i,j)=Ke(1,1)+Ke(2,2);
end
elseif(i==j+1)
k(i,j)=Ke(1,2);
elseif(j==i+1)
k(i,j)=Ke(2,1);
else
k(i,j)=0;
end
end
end
%********************End Assembly*****************************
%The Global f Matrix
f = zeros(ne1+1,1);
%BC apply u(0) = 0
f(1,1) = 0;
%BC apply u(d) = h
f(ne1+1,1) = h;
% Display the Global stifness matrix before striking row
K_Global=k
%Striking first row (u1=0)
k(1,1) = 1;
for i=2:ne1+1
k(1,i) = 0;
k(ne1+1,i) = 0;
end
k(ne1+1,ne1+1) = 1;
% Display the solvable stifness matrix
K_strike=k
%solving the result and finding the displacement matrix, {u}
u=inv(k)*f
hold on
% ======Calculating Approximate Solution and plotting============
syms X
U_sym=sym(zeros(ne1,1));
dU_sym=sym(zeros(ne1,1));
for i=1:ne1
N1x=1-((X-x(i))/le);
N2x=(X-x(i))/le;
U_X=(u(i)*N1x)+(u(i+1)*N2x);
U_sym(i)=U_X;
dU_sym(i)=diff(U_sym(i));
subplot(3,1,1)
hold on
ezplot(U_sym(i),[x(i) x(i+1)])
subplot(3,1,2)
hold on
% du/dx approximate
ezplot(dU_sym(i),[x(i) x(i+1)])
end

My octave function returns "ans = 0" -Coursera Machine Learning Week 2 problem

I am currently taking Andrew Nguyen's coursera machine learning course and I am on week 2. For a cost function assignment, my function keeps on returning "ans = 0" when it should be returning "ans= 32.07:
My code is below (The variables have been defined in the command window):
%COMPUTECOST Compute cost for linear regression
% J = COMPUTECOST(X, y, theta) computes the cost of using theta as the
% parameter for linear regression to fit the data points in X and y
% Initialize some useful values
% number of training examples
m = length(y);
% You need to return the following variables correctly
J =0;
% ====================== YOUR CODE HERE ======================
% Instructions: Compute the cost of a particular choice of theta
% You should set J to the cos
h = X * theta;
J = (1/(2m)*(sum(h-y).^2));
% =========================================================================
end

Subscript indices must be real positive integers or logicals

function [theta, J_history] = gradientDescent(X, y, theta, alpha, num_iters)
%GRADIENTDESCENT Performs gradient descent to learn theta
% theta = GRADIENTDESENT(X, y, theta, alpha, num_iters) updates theta by
% taking num_iters gradient steps with learning rate alpha
% Initialize some useful values
m = length(y); % number of training examples
J_history = zeros(num_iters, 1);
for iter = 1:num_iters
% ====================== YOUR CODE HERE ======================
% Instructions: Perform a single gradient step on the parameter vector
% theta.
%
% Hint: While debugging, it can be useful to print out the values
% of the cost function (computeCost) and gradient here.
%
hypothesis = x*theta;
theta_0 = theta(1) - alpha(1/m)*sum((hypothesis-y)*x);
theta_1 = theta(2) - alpha(1/m)*sum((hypothesis-y)*x);
theta(1) = theta_0;
theta(2) = theta_1;
% ============================================================
% Save the cost J in every iteration
J_history(iter) = computeCost(X, y, theta);
end
end
I keep getting this error
error: gradientDescent: subscript indices must be either positive integers less than 2^31 or logicals
on this line right in-between the first theta and =
theta_0 = theta(1) - alpha(1/m)*sum((hypothesis-y)*x);
I'm very new to octave so please go easy on me, and
thank you in advance.
This is from the coursera course on Machine Learning from Week 2
99% sure your error is on the line pointed out by topsig, where you have alpha(1/m)
it would help if you gave an example of input values to your function and what you hoped to see as an output, but I'm assuming from your comment
% taking num_iters gradient steps with learning rate alpha
that alpha is a constant, not a function. as such, you have the line alpha(1/m) without any operator in between. octave sees this as you indexing alpha with the value of 1/m.
i.e., if you had an array
x = [3 4 5]
x*(2) = [6 8 10] %% two times each element in the array
x(2) = [4] %% second element in the array
what you did doesn't seem to make sense, as 'm = length(y)' which will output a scalar, so
x = [3 4 5]; m = 3;
x*(1/m) = x*(1/3) = [1 1.3333 1.6666] %% element / 3
x(1/m) = ___error___ %% the 1/3 element in the array makes no sense
note that for certain errors it always indicates that the location of the error is at the assignment operator (the equal sign at the start of the line). if it points there, you usually have to look elsewhere in the line for the actual error. here, it was yelling at you for trying to apply a non-integer subscript (1/m)

Creating a MATLAB system with tunable parameters for system identification

Im trying to get MATLAB to create a state space model with initial values, which i later have to fine tune using the system identification toolbox.
The problem is that i am doing this with "white-box" models, which means that the A-matrix in my model isn't just a matrix of numeric values, but consists of several other parameters.
Since each of the parameters that makes up the matrix has a physical meaning, i'd like to estimate that seperately instead of just the value of the A-matrix.
Is this possible in any way? Have looked at both genss, idss and several other tools, but haven't been able to make any of them work as of yet.
A version of the system i'll be working with is as follows (C and D matrices are not relevant, since this is just testing really):
A = [-H_infil/Ca+Hsa_i^2/(Ca*(Hms_i+Hsa_i))-Hsa_i/Ca-H_win/Ca+Hsa_e^2/(Ca*(Hsa_e+Hms_e))-Hsa_e/Ca-H_vent/Ca Hsa_i*Hms_i/((Hms_i+Hsa_i)*Ca) Hsa_e*Hms_e/((Hsa_e+Hms_e)*Ca);
Hms_i*Hsa_i/((Hms_i+Hsa_i)*Ci) Hms_i^2/((Hms_i+Hsa_i)*Ci)-Hms_i/Ci 0;
Hms_e*Hsa_e/((Hsa_e+Hms_e)*Ce) 0 Hms_e^2/((Hsa_e+Hms_e)*Ce)-Hms_e/Ce-Hem/Ce];
Bc = [Hsa_i*S*wi/(Ca*(Hms_i+Hsa_i))+S*wa/Ca Hsa_i*fi/(Ca*(Hms_i+Hsa_i))+fa/Ca+Hsa_e*fe/(Ca*(Hsa_e+Hms_e)) H_infil/Ca+H_win/Ca H_vent/Ca;
Hms_i*S*wi/((Hms_i+Hsa_i)*Ci) Hms_i*fi/((Hms_i+Hsa_i)*Ci) 0 0;
0 Hms_e*fe/((Hsa_e+Hms_e)*Ce) Hem/Ce 0];
Cc = [0 0 0];
Dc = [0 0 0 0]
I realize that i may run into a problem with several solutions, but then i figured that the system identification would just choose one.
Any ideas?
Thanks in advance!
oh, and initial values goes as follows:
%% Q_Heating ratio factors are defined
% Factors
ki = 0.6;
ke = 0;
ka = 1 - ki - ke;
%% Internal heat gain factors are defined
fe = 0; % Internal heat gain ratio to external constructions
fi = 0; % Internal heat gain ratio to internal constructions
fa = 1 - fe - fi; % Internal heat gain ratio to room air
%% Solar heat gain factors are defined
S = 0.558; % Shading factor
wi = 0.6; % Solar heat gain ratio to internal constructions
wa = 1 - wi; % Solar heat gain ratio to room air
%% Capacities
% Air node
Ca = 60708.707;
% Internal node
Ci = 6.160*10^6*1.3;
% External node
Ce = 5.489*10^5*1.3;
%% Heat transfer coefficients
% Air to surface heat transfer coefficients
Hsa_i = 581.286;
Hsa_e = 52.094;
% Surface to mass heat transfer coefficients
Hms_i = 3235.007;
Hms_e = 284.432;
% Mass to external air/ground heat transfer coefficient
Hem = 0.986*1.3;
% Room air to external air heat transfer coefficients
H_infil = 0;
H_win = 1.627;
% Ventilation heat transfer coefficient
H_vent = 0;