Fix the error with "Error using urlread'

2 views (last 30 days)
Hi,
I am using MATLAB with apm (APMonitor) to find the parameters of an equation but I got an error :
"Error using urlread
The value of 'url' is invalid. Expected input to be one of these types:
char
Instead its type was java.net.URL."
Does anyone knows how to fix this?
Thank you in advance
% Add APMonitor toolbox available from
% http://apmonitor.com/wiki/index.php/Main/MATLAB
addpath('apm')
% server and application
s = 'http://byu.apmonitor.com';
a = 'regression';
% clear any prior application
apm(s,a,'clear all');
% load model and data files
apm_load(s,a,'model.apm');
csv_load(s,a,'data.csv');
% configure parameters to estimate
apm_info(s,a,'FV','a');
apm_info(s,a,'FV','b');
apm_info(s,a,'FV','c');
apm_option(s,a,'a.status',1);
apm_option(s,a,'b.status',1);
apm_option(s,a,'c.status',1);
apm_option(s,a,'nlc.imode',2);
% solve nonlinear regression
output = apm(s,a,'solve');
disp(output)

Answers (1)

Cris LaPierre
Cris LaPierre on 1 Sep 2022
Assuming you are trying to run the example_nlc demo files that come with APM, I was unable to duplicate your error. Is your path to the APM folder correct taking into consideration your current folder? Is your current folder correct?
Can you provide more details?
unzip apm_matlab_v0.7.2.zip
cd('example_nlc')
% Add APMonitor toolbox available from
% http://apmonitor.com/wiki/index.php/Main/MATLAB
addpath('../apm/')
% server and application
s = 'http://byu.apmonitor.com';
a = 'regression';
% clear any prior application
apm(s,a,'clear all');
% load model and data files
apm_load(s,a,'model.apm');
csv_load(s,a,'data.csv');
% configure parameters to estimate
apm_info(s,a,'FV','a');
apm_info(s,a,'FV','b');
apm_info(s,a,'FV','c');
apm_option(s,a,'a.status',1);
apm_option(s,a,'b.status',1);
apm_option(s,a,'c.status',1);
apm_option(s,a,'nlc.imode',2);
% solve nonlinear regression
output = apm(s,a,'solve');
disp(output)
apm 44.204.252.150_regression <br><pre> ---------------------------------------------------------------- APMonitor, Version 1.0.1 APMonitor Optimization Suite ---------------------------------------------------------------- --------- APM Model Size ------------ Each time step contains Objects : 0 Constants : 0 Variables : 4 Intermediates: 0 Connections : 0 Equations : 2 Residuals : 2 Number of state variables: 16 Number of total equations: - 16 Number of slack variables: - 0 --------------------------------------- Degrees of freedom : 0 ---------------------------------------------- Model Parameter Estimation with APOPT Solver ---------------------------------------------- Iter Objective Convergence 0 0.00000E+00 2.00000E+00 1 0.00000E+00 2.00000E+00 Successful solution --------------------------------------------------- Solver : APOPT (v1.0) Solution time : 1.290000000153668E-002 sec Objective : 0.000000000000000E+000 Successful solution --------------------------------------------------- </pre>
  3 Comments
Birsen Ayaz-Maierhafer
Birsen Ayaz-Maierhafer on 1 Sep 2022
Hi Chris,
I just joined the forum and posted this question in the forum.
Thank you

Sign in to comment.

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Tags

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!