Vector Newton Raphson Method coding help
    7 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I have a code for the Vector Newton Raphson method (which solves 2 functions that are a function of both x and y) and I am getting the error 'Subscripted assignment dimension mismatch' at line 17 and 18. If anyone has any clue how to fix this problem to where my code runs smoothly I would really appreciate it!
x=15;
y=12;
v=[x;y];
tol=.01;
loopcnt=0;
Maxloop=56;
while loopcnt<Maxloop
      f1t=-sind(x)-sind(x+y);
      f1b=-sind(x+y);
      f2t=cosd(x)+cosd(x+y);
      f2b=cosd(x+y);
      Jacobian=[f1t f1b;f2t f2b];
      f1=cosd(x)+cosd(x+y)-1;
      f2=sind(x)+sind(x+y)-1.1;
      F=[f1;f2];
      vNew=v-inv(Jacobian)*F;
      vNew(1,1)=xNew
      vNew(2,1)=yNew
      xNew=x
      yNew=y
      if (vNew-vOld)>tol
      else 
          break
      end
      loopcnt=loopcnt+1;
  end
1 comentario
  Jan
      
      
 el 1 de Nov. de 2015
				
      Editada: Jan
      
      
 el 1 de Nov. de 2015
  
			Please do not let us guess, which one is the line 17 and 18. But, by the way, it is impossible that the line 18 stops with an error, if the code stops in line 17 already.
The code should stop in the line "vNew(1,1)=xNew" also due to an unknown variable "xNew".
Respuestas (1)
  Nitin Khola
    
 el 3 de Nov. de 2015
        The error message that you are getting has been discussed here:  http://www.mathworks.com/matlabcentral/answers/93586-why-do-i-get-the-subscripted-assignment-dimension-mismatch-error-message
For the community to help you better, please make sure you provide code that reproduces the issue. As Jan Simon pointed out, define xNew, vOld etc.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


