Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 64824

Submitted on 22 Mar 2012

Incorrect

73Size
Leading solution size is 74.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
assert(isempty(regexp(fileread('Rosenbrock_banana.m'),'assert.m')))

                    
2
Fail
 
%%
x = [0; 0];
assert(isequal(Rosenbrock_banana(x),1))
Error: License checkout failed.
License Manager Error -5
Cannot find a license for Symbolic_Toolbox.
Troubleshoot this issue by visiting:
<a href="http://www.mathworks.com/support/lme/R2013a/5">http://www.mathworks.com/support/lme/R2013a/5</a>
Diagnostic Information:
Feature: Symbolic_Toolbox
License path: 13501@10.206.97.41:13501@10.10.207.33:/tmp/matlabpref/.matlab/R2013a_licenses:/opt/mlsedu/matlab/R2013a/licenses/license.dat:/opt/mlsedu/matlab/R2013a/licenses
Licensing error: -5,0.
3
Fail
 
%%
x = [1; 1];
assert(isequal(Rosenbrock_banana(x),0))
Error: License checkout failed.
License Manager Error -5
Cannot find a license for Symbolic_Toolbox.
Troubleshoot this issue by visiting:
<a href="http://www.mathworks.com/support/lme/R2013a/5">http://www.mathworks.com/support/lme/R2013a/5</a>
Diagnostic Information:
Feature: Symbolic_Toolbox
License path: 13501@10.206.97.41:13501@10.10.207.33:/tmp/matlabpref/.matlab/R2013a_licenses:/opt/mlsedu/matlab/R2013a/licenses/license.dat:/opt/mlsedu/matlab/R2013a/licenses
Licensing error: -5,0.
4
Fail
 
%%
x = [1; -1];
assert(isequal(Rosenbrock_banana(x),400))
Error: License checkout failed.
License Manager Error -5
Cannot find a license for Symbolic_Toolbox.
Troubleshoot this issue by visiting:
<a href="http://www.mathworks.com/support/lme/R2013a/5">http://www.mathworks.com/support/lme/R2013a/5</a>
Diagnostic Information:
Feature: Symbolic_Toolbox
License path: 13501@10.206.97.41:13501@10.10.207.33:/tmp/matlabpref/.matlab/R2013a_licenses:/opt/mlsedu/matlab/R2013a/licenses/license.dat:/opt/mlsedu/matlab/R2013a/licenses
Licensing error: -5,0.
5
Fail
 
%%
x = [-1; 0.5];
assert(isequal(Rosenbrock_banana(x),29))
Error: License checkout failed.
License Manager Error -5
Cannot find a license for Symbolic_Toolbox.
Troubleshoot this issue by visiting:
<a href="http://www.mathworks.com/support/lme/R2013a/5">http://www.mathworks.com/support/lme/R2013a/5</a>
Diagnostic Information:
Feature: Symbolic_Toolbox
License path: 13501@10.206.97.41:13501@10.10.207.33:/tmp/matlabpref/.matlab/R2013a_licenses:/opt/mlsedu/matlab/R2013a/licenses/license.dat:/opt/mlsedu/matlab/R2013a/licenses
Licensing error: -5,0.
6
Fail
 
%%
x = [0; 0];
[~,grad]=Rosenbrock_banana(x);
assert(isequal(grad,[-2; 0]))
Error: License checkout failed.
License Manager Error -5
Cannot find a license for Symbolic_Toolbox.
Troubleshoot this issue by visiting:
<a href="http://www.mathworks.com/support/lme/R2013a/5">http://www.mathworks.com/support/lme/R2013a/5</a>
Diagnostic Information:
Feature: Symbolic_Toolbox
License path: 13501@10.206.97.41:13501@10.10.207.33:/tmp/matlabpref/.matlab/R2013a_licenses:/opt/mlsedu/matlab/R2013a/licenses/license.dat:/opt/mlsedu/matlab/R2013a/licenses
Licensing error: -5,0.
7
Fail
 
%%
x = [0; 0];
[~,~,Hess]=Rosenbrock_banana(x);
assert(isequal(Hess,diag([2, 200])))
Error: License checkout failed.
License Manager Error -5
Cannot find a license for Symbolic_Toolbox.
Troubleshoot this issue by visiting:
<a href="http://www.mathworks.com/support/lme/R2013a/5">http://www.mathworks.com/support/lme/R2013a/5</a>
Diagnostic Information:
Feature: Symbolic_Toolbox
License path: 13501@10.206.97.41:13501@10.10.207.33:/tmp/matlabpref/.matlab/R2013a_licenses:/opt/mlsedu/matlab/R2013a/licenses/license.dat:/opt/mlsedu/matlab/R2013a/licenses
Licensing error: -5,0.
8
Fail
 
%%
x = [1; 1];
[~,grad]=Rosenbrock_banana(x);
assert(isequal(grad,[0; 0]))
Error: License checkout failed.
License Manager Error -5
Cannot find a license for Symbolic_Toolbox.
Troubleshoot this issue by visiting:
<a href="http://www.mathworks.com/support/lme/R2013a/5">http://www.mathworks.com/support/lme/R2013a/5</a>
Diagnostic Information:
Feature: Symbolic_Toolbox
License path: 13501@10.206.97.41:13501@10.10.207.33:/tmp/matlabpref/.matlab/R2013a_licenses:/opt/mlsedu/matlab/R2013a/licenses/license.dat:/opt/mlsedu/matlab/R2013a/licenses
Licensing error: -5,0.
9
Fail
 
%%
x = [1; 1];
[~,~,Hess]=Rosenbrock_banana(x);
assert(isequal(Hess,[802, -400; -400, 200]))
Error: License checkout failed.
License Manager Error -5
Cannot find a license for Symbolic_Toolbox.
Troubleshoot this issue by visiting:
<a href="http://www.mathworks.com/support/lme/R2013a/5">http://www.mathworks.com/support/lme/R2013a/5</a>
Diagnostic Information:
Feature: Symbolic_Toolbox
License path: 13501@10.206.97.41:13501@10.10.207.33:/tmp/matlabpref/.matlab/R2013a_licenses:/opt/mlsedu/matlab/R2013a/licenses/license.dat:/opt/mlsedu/matlab/R2013a/licenses
Licensing error: -5,0.
10
Fail
 
%%
x = [-1.9; 2];
correct_value = 267.6200;
correct_grad = -1e3*[1.2294; 0.3220];
correct_Hess = [3534, 760; 760, 200];
[val,grad,Hess]=Rosenbrock_banana(x);
assert(isequal(str2num(num2str(val)),correct_value))
assert(isequal(str2num(num2str(grad)),correct_grad))
assert(all(max(abs(Hess-correct_Hess)<1e-8)))
Error: License checkout failed.
License Manager Error -5
Cannot find a license for Symbolic_Toolbox.
Troubleshoot this issue by visiting:
<a href="http://www.mathworks.com/support/lme/R2013a/5">http://www.mathworks.com/support/lme/R2013a/5</a>
Diagnostic Information:
Feature: Symbolic_Toolbox
License path: 13501@10.206.97.41:13501@10.10.207.33:/tmp/matlabpref/.matlab/R2013a_licenses:/opt/mlsedu/matlab/R2013a/licenses/license.dat:/opt/mlsedu/matlab/R2013a/licenses
Licensing error: -5,0.