1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab error, can you help?

  1. Jan 30, 2015 #1
    1. The problem statement, all variables and given/known data
    Hello, i have a matlab code that simply lists a bunch of parameters with values and an equation that relates all of them together. I am getting on error that says

    Error in ==> randelltest at 17
    Ys0=Yl*{(Pm-Pc)*Yc/Yl*(1-Av*Tm/2*Yc/Yl)-Av*Tm*Pm/2}*(1-1/B);

    Is there a problem with this syntax somewhere ?

    3. The attempt at a solution

    Code in full (matlab noob)


    % Parameters


    Yl=100; % initial lithosphere thickness
    Yc=30; % Initial crustal thickness
    Pm=3400; % mantle density
    Pc=2670; % crustal density
    Ps=2670; % basin material density
    Av=2.4*10^-5; % volumetric coefficient of thermal expansion
    Tm=1300; % mantle temperature at top of asthenosphere
    B=(1:0.1:4); % stretching factor

    % Equation for fault controlled subsidence

    Ys0=Yl*{(Pm-Pc)*Yc/Yl*(1-Av*Tm/2*Yc/Yl)-Av*Tm*Pm/2}*(1-1/B);

    Ys1=Ys0/Pm(1-Av*Tm)-Ps;

    plot(B,Ys1)
     
  2. jcsd
  3. Jan 30, 2015 #2
    The brackets {} have a special meaning related to MATLAB cells, so you should replace them with (). You should also replace '1/B' with '1./B', so you get element-wise, and not matrix, division.

     
  4. Jan 30, 2015 #3
    Thanks for clearing that up, what is the purpose of the "." ? I cleared up the other error you pointed out too.
     
  5. Jan 30, 2015 #4
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Matlab error, can you help?
  1. MATLAB errors (Replies: 4)

  2. Can you guys help me e (Replies: 0)

Loading...