f



??? Output argument "r" (and maybe others) not assigned during call to "/home/mat/nonlinear_g.m>nonlinear_g".

Hi,

I have been writing a code to solve a nonlinear system of waves and I am using the Newton -Raphson method to solve the system. I have a main program which computes the Jacobian and solves the linar system and I have a function which I discretise my system of equations.

I get an odd error of:
??? Output argument "r" (and maybe others) not assigned during call to "/home/mat/nonlinear_g.m>nonlinear_g".
My function that I have written is:
function r=nonlinear_g(s,p,L,n,W)
X=W(1:L);
Y=W(L+1:2*L);
u=W(2*L+1:3*L);
v=W(3*L+1:4*L);
E_x=W(4*L+1:5*L);
E_y=W(5*L+1:6*L);
h=1;
B=0.2;
E_b=0.1;
E_0=0.3;
U=0.2;
ds=s(2)-s(1);
c=floor(n/L);
d=n-c*L;
if (d==0)
    d=L;
end
%Prepare for the Calculation
s_half=zeros(1,L-1);
X_half=zeros(1,L-1);
Y_half=zeros(1,L-1);
u_half=zeros(1,L-1);
v_half=zeros(1,L-1);
E_x_half=zeros(1,L-1);
E_y_half=zeros(1,L-1);
for k=1:L-1
    s_half(k)=0.5*(s(k)+s(k+1));
    X_half(k)=0.5*(W(k)+W(k+1));
    Y_half(k)=0.5*(W(k)+W(k+1));
    u_half(k)=0.5*(W(k)+W(k+1));
    v_half(k)=0.5*(W(k)+W(k+1));
    E_x_half(k)=0.5*(W(k)+W(k+1));
    E_y_half(k)=0.5*(W(k)+W(k+1));
    
end
X_prime=gradient(X,ds);
Y_prime=gradient(Y,ds);
switch c
    case 0
        %r=X_prime(d)^2+Y_prime(d)^2-1;
        if (d==1)
            r=((4*X(1)-X(2))/3)^2+((4*Y(1)-Y(2))/3)^2-1;
        else
            r=((X(d)-X(d-1))/ds)^2+((Y(d)-Y(d-1))/ds)^2-1;
        end
    case 1
        a_1=0.5*(u(d)^2+v(d)^2)+p(d)+B*Y(d);
        a_2=E_b/(1+(Y_prime(d)/X_prime(d))^2);
        a_3=E_x(d)^2-E_y(d)^2;
        a_4=(Y_prime(d)/X_prime(d))^2;
        K=gradient(Y_prime,ds).*X_prime-gradient(X_prime,ds).*Y_prime;
        r=a_1+a_2*(0.5*a_4*a_3-2*E_x(d)*E_y(d)*sqrt(a_4)-0.5*a_3)-K(d)-0.5*E_b;
    case 2
        r=Y_prime(d)*u(d)-X_prime(d)*v(d);
    case 3
        r=X_prime(d)*E_x(d)+Y_prime(d)*E_y(d);
    case 4
        b_1=(u_half-U).*((X_half-X(d)).*gradient(X_half,ds)+(Y_half-Y(d)).*gradient(X_half,ds));
        b_2=(X_half-X(d)).^2+(Y_half-Y(d)).^2;
        b_3=v_half.*((X_half-X(d)).*gradient(Y_half,ds)-(Y_half-Y(d)).*gradient(X_half,ds));
        b_4=(u_half-U).*((X_half-X(d)).*gradient(X_half,ds)+(Y_half-Y(d)+2*h).*gradient(X_half,ds));
        b_5=(X_half-X(d)).^2+(Y_half-Y(d)+2*h).^2;
        b_6=v_half.*((X_half-X(d)).*gradient(Y_half,ds)-(Y_half-Y(d)+2*h).*gradient(X_half,ds));
        r=pi*v(d)-trapz(s_half,(b_1+b_3)./b_2)+trapz(s_half,(b_4+b_6)./b_5);
    case 5
        c_1=(X_half-X(d)).*(E_0*gradient(X_half,ds)+(E_x_half-E_y_half).*gradient(Y_half,ds));
        c_2=(Y_half-Y(d)).*(E_0*gradient(Y_half,ds)-(E_x_half-E_y_half).*gradient(X_half,ds));
        c_3=(X_half-X(d)).^2+(Y_half-Y(d)).^2;
        r=pi*E_x(d)-trapz(s_half,(c_1+c_2)./c_3);
end

Can anyone suggest where I may have been going wrong?

Mat
0
Mat
11/2/2010 11:03:04 AM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
2420 Views

Similar Articles

[PageSpeed] 20

It's odd, the function only bombs out when the maximum value for the row appears, when this happens, everything goes wrong.

Mat
0
Mat
11/2/2010 12:46:03 PM

"Mat " <maff.hunt@googlemail.com> wrote in message 
news:iaor58$nil$1@fred.mathworks.com...
> Hi,
>
> I have been writing a code to solve a nonlinear system of waves and I am 
> using the Newton -Raphson method to solve the system. I have a main 
> program which computes the Jacobian and solves the linar system and I have 
> a function which I discretise my system of equations.
>
> I get an odd error of:
> ??? Output argument "r" (and maybe others) not assigned during call to 
> "/home/mat/nonlinear_g.m>nonlinear_g".

That's correct -- and it only happens when floor(n/L) [aka c in your code] 
is something other than 0, 1, 2, 3, 4, or 5, right?

If c is something other than one of those six values, NONE of the cases in 
your SWITCH-CASE block will trigger and so you never assign a value to the 
variable r.  Then when the function tries to exit, MATLAB tries to obtain 
the value of r to return to the calling function, can't find such a 
variable, and exits.

To fix this, either figure out why c takes on a value other than those six, 
or add a DEFAULT case to your SWITCH-CASE statement that handles the 
scenario where c is different appropriately.

*snip most of the code*

> switch c
>    case 0

*snip code that assigns to r*

>    case 1

*snip code that assigns to r*

>    case 2

*snip code that assigns to r*

>    case 3

*snip code that assigns to r*

>    case 4

*snip code that assigns to r*

>    case 5

*snip code that assigns to r*

> end

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 

1
Steven_Lord
11/2/2010 1:49:13 PM
Reply:

Similar Artilces:

error " Output argument "rate_match_output1" (and maybe others) not assigned during call to "C:\Users\USER\Documents\MATLAB\new_work\turbo1.m>turbo1".
my code is function [ Z_TOT,Z_TOT_INTR,rate_match_output,rate_match_output1,F] = turbo1( SEG_BLOCKS ) global c_min global c_max global k_min global k_max global block_size global filler_bits global F1 global F2 persistent rate1 persistent rate2 %% matrix of k from aseel code load turbo_intr %% calculation of f2 matrix load turbo_intr_2 %% matrix of f1 load turbo_intr_1 %i am trying to seperate blocks from SEG_BLOCKS MIN_BLOCKS=SEG_BLOCKS(1,(c_max*block_size(1)+1):end); for t=1:c_min N1=block_size(c_max+1); c1=MIN_BLOCKS(1,((t-1)*N1+1:(t*N1))); x_k1=c1; %% encode the message m1=0; % initial content of memory register equal zero m2=0; p=0; m3=0; z1=zeros(1,N1); for i=1:N1 % For N input bits b = xor(c1(i),m2); d = xor(b,m1); z1(i)=xor(d,p); m2=xor(m3,p); p=m3; m3=m1; % Content of memory register m1 shifting to m3 m1=b; end z1_tot(1,((t-1)*N1+1:(t*N1)))=z1; % the total output after encoder %% choose the value of f1 & f2 k1 = k_min; G=find(k1==turbo_intr); f1_value =turbo_intr_1(G); f2_value=turbo_intr_2(G); %% matrix after interleaver c_intr=zeros(1,N1); x=zeros(1,N1); for s=1:N1 x(s)=mod((f1_value*s + f2_value*(s^2)),k1 ); if x(s)==0 x(s)=s; end c_intr(s)=c1(x(s)); end ...

Error in get_Prefix (line 4) maskTmp = zeros(1,4); Output argument "prefix" (and maybe others) not assigned during call to "C:\Users\Suraj\Desktop\subfolder\get_Prefix.m>get_Prefix". Error in pr
function [prefix] = get_Prefix(inputIP,mask) maskTmp = zeros(1,4); for i=1:4 if mask >= 8 maskTmp(i) = 255; mask = mask-8; elseif mask ==0 maskTmp(i) = 0; else tmp=zeros(1,8); tmp(1:mask)=1; maskTmp(i) = sum(tmp.*2.^(numel(tmp)-1:-1:0)); mask=0; end end mask=maskTmp; numIP= convert_IP(inputIP); if numIP ~=-1 prefix = bitand(numIP,mask); prefix = convert_IP(prefix); end end ...

??? Output argument "r" (and maybe others) not assigned during call to
So here's my problem.. this is the code i type to use euler's 2nd order to numerically integrate the following equation, However, when i call the function with EulerMSM([0 8],0.2) in the command window, this error returns, Error in ==> EulerMSM>f_euler at 46 f_euler= -0.4*u - x - 0.5*x^3 +0.5*cos(0.5*t); ??? Output argument "maineqn" (and maybe others) not assigned during call to "c:\Program Files\MATLAB\R2009a\Euler\EulerMSM.m>f_euler". Error in ==> EulerMSM at 35 a(i) = f_euler(t(i),x(i),u(i)); The full program is as below and i've tried many things to solve this.. but still could not get it.. Any help is highly appreciated function EulerMSM(tspan,h) % EulerMSM(dydt,tspan,y0,h): % uses Euler's method to integrate an ODE % input: % dydt = name of the M-file that evaluates the ODE % tspan = [ti, tf] where ti and tf = initial and % final values of independent variable % y0 = initial value of dependent variable % h = step size % output: % t = vector of independent variable % y = vector of solution for dependent variable ti = tspan(1)+1; tf = tspan(2)+1; time = (ti:h:tf); N = length(time); % if necessary, add an additional value of t % so that range goes from t = ti to tf %declaring variables t = zeros(N+1,1); x = zeros(N+1,1); u = zeros(N+1,1); a = zeros(N+1,1); b = zeros(N+1,1); c = zeros(N+1,1); %initial Conditions t(1) = 0; x(1) = 0; u(1) = 0; ...

"out" and "in out"
Hi i found the following explaination: In Ada, "in" parameters are similar to C++ const parameters. They are effectively read-only within the scope of the called subprogram. Ada "in out" parameters have a reliable initial value (that passed in from the calling subprogram) and may be modified within the scope of the called procedure. Ada "out" parameters have no reliable initial value, but are expected to be assigned a value within the called procedure. What does "have no reliable initial value" mean when considering the "out" parameter? By c...

about "++" and "--"
why this program snippet display "8,7,7,8,-7,-8" the program is: main() { int i=8; printf("%d\n%d\n%d\n%d\n%d\n%d\n",++i,--i,i++,i--,-i++,-i--); } > why this program snippet display "8,7,7,8,-7,-8" Ask your compiler-vendor because this result is IMHO implementation-defined. Check this out: http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.15 http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.16 Regards, Irina Marudina fxc123@gmail.com wrote: > why this program snippet display "8,7,7,8,-7,-8&q...

why "::", not "."
Why does the method of modules use a dot, and the constants a double colon? e.g. Math::PI and Math.cos -- Posted via http://www.ruby-forum.com/. On Oct 26, 2010, at 01:48 , Oleg Igor wrote: > Why does the method of modules use a dot, and the constants a double > colon? > e.g. > Math::PI and Math.cos For the same reason why inner-classes/modules use double colon, because = they're constants and that's how you look up via constant namespace. Math::PI and ActiveRecord::Base are the same type of lookup... it is = just that Base is a module and PI is a float....

Urgent need """""""""""INFORMATICA DEVELOPER"""""""""""""
Hello Partners, How are you ? Please find the requirements below. Title: Database/ETL Developer Duration: 6 months Location: NY Exp: 7+ Locals preferred Database/ETL requirements (Mandatory) Candidate must have worked with financial instruments, preferably Mutual Funds but, Equities are also ok. PL/SQL - packages, Stored procs, Functions, Aggregate functions, Pipelined Functions Informatica 8.6 - especially complex mappings, complex maplets, complex workflows, transformations Oracle 10g/11g Unix/Linux shell scripting Database/ETL requirements (Optional) Data warehousing experience Threading and job concepts in 10g/11g Cost based Optimizer concepts in 10g/11g Must : Experience with XML files and partitioning concepts in Oracle, Collections, Material Views Note : No phone calls please. : send Resumes to karthik@bhaninfo.com Thanks & Regards Karthik BhanInfo karthik@bhaninfo.com ...

why have both "." and "->" ?
I used to remember why c++ needed both ? Could somebody help me here ? For example class A{ f(); }; A* aa; You could do either "aa->f()" or "(*aa).f()". So why does C++ need both operators. Raj "raj" <rajkumar@hotmail.com> schreef in bericht news:d7fee6d0.0406230748.694b966b@posting.google.com... > I used to remember why c++ needed both ? > Could somebody help me here ? > > For example > > class A{ > f(); > }; > > A* aa; > > You could do either "aa->f()" or "(*aa).f()". So why does C++...

"In" "Out" and "Trash"
I just bought a new computer and I re-installed Eudora Light on my new computer. But when I open Eudora, the "In", "Out" and "Trash" links are not on the left side of the screen the way they were on my old computer. How can I get these links back on the left side of the screen? Thank you. On 25 Mar 2007 09:49:22 -0700, "abx" <abfunex@yahoo.com> wrote: >I just bought a new computer and I re-installed Eudora Light on my new >computer. But when I open Eudora, the "In", "Out" and "Trash" links >are ...

what does "->" and "=>" do?
I have read through php.net manuals and have not see any mention about what these operands actually do. I have seen them used in a bunch of different code lately and don't really understand. Example 1: // Legacy Function: Renders the Footer of the Theme function themefooter() { global $engine, $index, $themepath; if ($index != 3) { $engine->do_themefooter($index); } } Example 2: // get the color scheme $colors = pnModAPIFunc('Xanthia','user','getSkinColors', array('skinid' => $skinID, 'paletteid' => $paletteid)); If anyo...

Function : Output argument "out" (and maybe others) not assigned during call to
My Principal function : function [out] = Cf( t,x ) LAMBDA=0; %constante de décroissance du soluté b=10^-3; %demi-largeur de la fente Dm=10^-10; %%coefficient de diffusion dans la matrice Vf=10^-5; %%vitesse d'advection dans la fente Xc=10^-1; %%profondeur de fracture Tc=Xc/Vf; %%temps advectif correspondant à la profondeur de fracture Zc=sqrt(Dm*Tc); %%longueur de diffusion dans la matrice %%nombres adimensionnels beta=b/Zc; %ZETA=z/Zc; T=1; %%temps final adimensionné par Tc nt=50; dt=T/nt; t=[0:dt:nt*dt]; X=1; nx=100; dx=X/nx; x=[0:dx:nx*dx]; %%Advection dans la fente selon Ox Cf=zeros(nt+1,nx+1); for i=1:nt+1 for j=1:nx+1 if(t(i)-x(j)>0) %%heaviside(t(i)-x(j)) Cf(i,j)=0.5*exp(-0*t(i))*x(j)/beta/(pi*(t(i)-x(j))^1.5)*exp(-x(j)^2/4/beta^2/(t(i)-x(j))); end end end %%Tracé de Cf en fonction de x à des temps donnés : Anim_cf_t=moviein(length(t)); for i=1:length(t) Anim_cf(i)=getframe; plot(x,Cf(i,:),'b') xlabel(i) axis([0 1.2 0 10]); end %%Tracé de Cf en fonction du temps pour x donné : Anim_cf_x=moviein(length(x)); figure; for k=1:length(x) Anim_cf(k)=getframe; plot(t,Cf(:,k),'r') xlabel(k) axis([0 1.2 0 10]); end end My function : function A = Cmax( t ) x=0.001; while Cf(t,x)<=Cf(t,(x+0.001)) x=x+0.001; end Cmaxi=Cf(t,x) X...

Urgent JAVA Requirement in """"""NEW YORK"""""""""
Hello Partners, How are you ? Please find the requirement below. Location : NY Duration : 8 mnths Rate :Open Job description: Java/J2EE Web Service Developer =B7 (4+ years of application development experience in Java/J2EE and Web service technologies. =B7 Experience with spring & Hibernate. =B7 Experience with J2EE Application Server (preferably Web logic). =B7 Preferable Aqua logic DSP Experience =B7 Preferable Sonic ESB Composite Service experience Experience working in UNIX environment. Good working knowledge of Oracle RDBMS and PL/SQL) Note : Please send your updated resume along with contact no to Karthik@bhaninfo.com. Thanks & Regards Karthik BhanInfo karthik@bhaninfo.com # 1572, 7 th Floor Suites, 1 Blue Hill Plaza Pearl River,NY-10965 www.bhaninfo.com ...

Passing "<", ">", "=", etc as an argument to a method?
Hello, I am just learning Java and am trying to write a method that does something like //=========================================== public Static List find(double[] array,double val,String relationalOp) { List list = new ArrayList(); for (int m = 0;m < array.length;m++) { // The following line is the problem if (array[m] relationalOp val) { list.add(array[m]); } } return list; } //=========================================== Is it possible to use an argument directly in an if statement like that? I am trying to avoid havin...

solution to ""ERROR: Output argument 'a' was not assigned during call to 'xlim'": Link to download xlim.m/ylim.m is not updated
Hi, I found technical solution to download new fixed xlim.m/ylim.m files in this adress: http://www.mathworks.com/support/solutions/en/data/1-19WWP/index.html?product=CO&solution=1-19WWP However they refering to a link to get the fixed files - but the link is not available any more. Do you know where I can download those files from? Thanks, Gilad "Gilad Asseraf" <gilad_asseraf@amat.com> wrote in message news:hsr9v6$333$1@fred.mathworks.com... > Hi, > I found technical solution to download new fixed xlim.m/ylim.m files in > this adress: &g...

How do fix: "Wrong number of arguments" / "invalid propert assignment" / "Invalid argument"
I'm trying to view a web page. IE tells me there are (Java?) errors on the page. Here they are: Line: 15 Char: 7 Error: Wrong number of arguments or invalid propert assignment Code: 0 URL: http://(address.of.my.webcam):port/LiveView.html and Line: 46 Char: 3 Error: Invalid argument Code: 0 URL: http://(address.of.my.webcam):port/LiveView.html When it says "line 15" or "line 46" , is that really the 15'th and 46'th line of "liveview.html" ??? What is "Char" referring to? Here is the contents...

Question about "sprintf" "@" "do for"
Hello, this works: A1=3D1 A2=3D2 A3=3D3 i=3D1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari do for [i=3D1:3]{ vari=3Dsprintf("A%.f",i) print vari } But I want to have "print vari,"=3D",@vari" in the loop. But it dosen't=20 work. Why can't I use "print vari,"=3D",@vari" in the loop? Is there a=20 solution for? J=C3=B6rg Jörg ...

Gary Sokolich """"""
"""""""""" http://www.manta.com/c/mmlq5dm/w-gary-sokolich W Gary Sokolich 801 Kings Road Newport Beach, CA 92663-5715 (949) 650-5379 http://www.tbpe.state.tx.us/da/da022808.htm TEXAS BOARD OF PROFESSIONAL ENGINEERS February 28, 2008 Board Meeting Disciplinary Actions W. Gary Sokolich , Newport Beach, California �V File B-29812 - It was alleged that Dr. Sokolich unlawfully offered or attempted to practice engineering in Texas (...) Dr. Sokolich chose to end the proceedings by signing a Consent Order that was accepted by ...

puts "\\".gsub("\\", "\\\\")
Hello, I have a mini-ruby quiz. Guess what this line of code writes to the console, then try it for yourself: puts "\\".gsub("\\", "\\\\") Why is that so? Martin From: martinus [mailto:martin.ankerl@gmail.com]=20 # Hello, I have a mini-ruby quiz. Guess what this line of code writes to # the console, then try it for yourself: # puts "\\".gsub("\\", "\\\\") puts "\\".gsub("\\", "\\\\") \ #=3D> nil # Why is that so? faq. escaping the escape in sub/gsub. search the archives. maybe you want somethin...

What does this mean ==> ?", ",""
If I run ?", ","" in the immediate window, I get a comma followed by 13 spaces. It is difficult for me to understand this. MLH wrote: > If I run ?", ","" > in the immediate window, > I get a comma followed by 13 spaces. > It is difficult for me to understand this. Have you made sure the HELP file is working? Have you ever actually opened it? commas put data in the debug window into columns. Some people learn by experimentation... some don't. I guess you fit into the latter category. Try this ?"a";"b" You'll get ab Try this ?"a","b" You'll get a b The semi-colon (;) separator means put the results straight after each other the comma (,) separator means put a tab between them (only of course it's not a tab it's x number of spaces. A colon (:) is a line separator in the debug window as well as in code so ?"a";"b":debug.Print "c";"d" returns ab cd And ?"a","b":debug.Print "c","d" returns a b c d and you can do stuff like x = "a": debug.Print x Which returns a To return to your post ?", ","" Means print a literal comma (",") and then a tab (,) and then an empty string (""). -- Terry Kreft "MLH" <CRCI@NorthState.net> wrote in message news:n4f192d189pbiu6mfu2dc...

how to change "/" to "\"
iam new to shell scripting and i have plz can anyone help in changing the pattrern "/" to "\" using the sed command. olympie@gmail.com wrote: > iam new to shell scripting and i have plz can anyone help in changing > the pattrern "/" to "\" using the sed command. sed 's/\//\\/g' will replace all '/' with '\' srp -- http://saju.net.in Saju Pillai <saju.pillai@gmail.com> wrote: >> iam new to shell scripting and i have plz can anyone help in changing >> the pattrern "/" to "\" using ...

what does the "+" and the "-" mean?
I recently read what the "+" and the "-" signs mean for compact discs. Of course, a friend has just asked me and I now forget. I've searched all over the place with no results. Anyone know? TIA! .. -------------------------------------- Mike Richter, were you born with "Scam Artist" emblazoned on your face? -------------------------------------- roscoe james wrote: > > I recently read what the "+" and the "-" signs mean for compact discs. Of > course, a friend h...

Re: "out" and "in out"
"no reliable initial value" means, you cannot rely on the value, but it may have a value. This depends on the parameter passing mechanism, which is _not_ related to the parameter mode (contrary to what many people think). So the parameter mode is there (nearly) solely for the information of the reader. The parameter passing mechanism for all kinds of parameters is defined in the RM. There are parameters passed by copy (in and out), by reference; for some it is explicitly left undefined. In your case, the passing mechanism is by reference, so you get what you get. But don't rely...

"A" is not equal "A"?
I was trying to convert String Array to String A through cycle and than compare the result with String B but eventhough results were the same it returned false. I'am working in BlueJ 3.1.0 Code is: public boolean Method () { String[] Example = {"a","b","c"}; String A = ""; String B = "abc" for (int i = 0; i<3 ; i++) { A = A + Example[i]; } if (A == B) { return true; } } never got true... I appreciate any suggestions how to solve this Den 08.04.2014 10:06, skrev 245dav@gmail.com:...

"==" is NOT TRUE "==", WHY?
[CODE START] x=5; y=8; if (x + y + 1E-15 == 13) a = 3 else a = 8 end [CODE END] When x + y + 1E-15, the code above returns a = 8. When x + y + 1E-16, the code above returns a = 3. Why? Kindly advise. Thanks. "onemilimeter Chen" <onemm@example.com> wrote in message <g7adrj$5tr$1@fred.mathworks.com>... > [CODE START] > x=5; > y=8; > if (x + y + 1E-15 == 13) > a = 3 > else > a = 8 > end > [CODE END] > > When x + y + 1E-15, the code above returns a = 8. > When x + y + 1E-16, the code above returns a = 3. > > Why? ...

Web resources about - ??? Output argument "r" (and maybe others) not assigned during call to "/home/mat/nonlinear_g.m>nonlinear_g". - comp.soft-sys.matlab

Resources last updated: 3/21/2016 7:41:37 AM