problems with assigning a global matrix - bet easy to solve - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# problems with assigning a global matrix - bet easy to solve

Posts: 1Member
hey you all Matlab users (probably knowing the program much better than I do, at least I hope so) - and sorry for my poor english, trying to do my best to be understood.

Im having some problems with pdepe, or rather, with globalizing a matrix. Im trying to solve a set of 4 partial differential equations. It's using some constants, which I set at the beginning of the function I built to solve it:
"function [t,x,cc1,cc2,cc3,cc4] = model_11_sim
global Pe eps u0 u1"

then im typing those u0/u1 constants in:
"u0 = [1e-3;1e-3;1e-3;1e-3];"
and:
"u1 = [0.45;0.4;0.1;0.05];"

a function, which is written few lines under is using those:
"function uw1=ul1(t)
global u0 u1
uw1 = u0(1)+(u1(1)-u0(1))*1.01^(1/(-10*t));"

the info im getting from matlab is:

"??? Attempted to access u1(1); index out of bounds because numel(u1)=0.
Error in ==> model_11_sim>ul1 at 110
uw1 = u0(1)+(u1(1)-u0(1))*1.01^(1/(-10*t));
Error in ==> model_11_sim>bound_cond at 128
pl = [(-1/eps)*(ul1(t)-ul(1));
Error in ==> pdepe at 247
[pL,qL,pR,qR] = feval(bc,xmesh(1),y0(:,1),xmesh(nx),y0(:,nx),t(1),varargin{:});
Error in ==> model_11_sim at 24
sol=pdepe(m,@main_pde,@init_cond,@bound_cond,x,t,options);"

Anyone please able to help me? I can send the whole function - its only about 50 lines of code, per email or PM over here. Thanks in advance for the help provided.