Rank: 593 based on 148 downloads (last 30 days) and 6 files submitted
photo

Mark Mikofski

E-mail
Company/University
SunPower
Lat/Long
37.91043090820312, -122.359260559082

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Mark View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
24 Apr 2013 Screenshot JGit4MATLAB JGit4MATLAB is a wrapper for JGit in MATLAB. It is meant to be used from the MATLAB command window. Author: Mark Mikofski git, scm, dvcs, version control, source control manage..., distributed version c... 22 0
18 Apr 2013 Screenshot polyVal2D and polyFit2D Evaluate 2D polynomials using Horner's method. Fit 2D polynomials to data using backslash operator. Author: Mark Mikofski mathematics, optimization, data exploration, interpolation, modeling 66 0
26 Mar 2012 Screenshot IAPWS_IF97 functional form with no slip Water and steam properties and derivatives based on the IAPWS IF97. Functional form. No slip. Author: Mark Mikofski control design, simulation, chemistry, modeling, hydrodynamics, thermodynamics 17 5
  • 4.66667
4.7 | 3 ratings
01 Mar 2012 myDynamicClass Create a set of objects from a text file. Author: Mark Mikofski data import, class, oop, objects 3 1
01 Mar 2012 polyfitZero Fit polynomial to data, forcing y-intercept to zero. Author: Mark Mikofski mathematics, modeling, data exploration, interpolation, polyfit, polyval 34 8
  • 4.33333
4.3 | 3 ratings
Comments and Ratings by Mark View all
Updated File Comments Rating
19 Feb 2013 JSONlab: a toolbox to encode/decode JSON files in MATLAB/Octave JSONlab is an open-source implementation of a JSON encoder and a decoder/parser for MATLAB/Octave. Author: Qianqian Fang

@Jan, I've been using a JSON.jar [1] I made from the java-json source [2] and it works perfectly. I don't know how native java speed compares with native MATLAB though.

[1] http://dl.dropbox.com/u/19049582/JSON.jar
[2] http://json.org/java/

30 May 2012 polyfitZero Fit polynomial to data, forcing y-intercept to zero. Author: Mark Mikofski

John, Sorry for my slow response. You can accomplish this the same way I zeroed out the last coefficient.

E.g. to force the 1st order coefficient to zero do the following:

% ...
x = x(:);
y = y(:);

% since you want might want to include the constant term,
% change "z" to be a matrix of ones, and make it one column wider
% to include the 0th-order term

% z = zeros(dim,degree); % comment out this line which doesn't include constant
z = ones(dim,degree+1); % add this line which now includes 0th-order term

for n = 1:degree
z(:,n) = x.^(degree-n+1);
end

% you don't have to calculate the constant term,
% because it will be a column of ones (i.e. x^0 = 1)
% now remove any columns that you don't want to fit
% e.g. we want to force the 1st order coefficient to zero
orderOfZeroCoeffs = 1; % a vector of terms to omit from regression, e.g. [1,0],
% you could make "orderOfZeroCoeffs" an input to the function

% now, remove the terms whose coeffs you want to zero
orderOfNonZeroCoeffs= ~ismember(degree:-1:0, orderOfZeroCoeffs);
z = z(:,orderOfNonZeroCoeffs); % replace z with the columns removed
% there are a 1000 other ways to write this code!

% comment out the following lines
% because now it's more complicated
% pZero = z\y;
% pZero = [pZero;0]';

% instead create a vector of zeros
% any terms not calculated are already set to zero
pZero = zeros(1,degree+1);
% substitute the coefficients directly into "pZero" by index assignment
pZero(orderOfNonZeroCoeffs) = z\y;

% ...

Try that out. I'm curious what you're using this for. Also check out the other polyfit0 (fex272) function that Jennifer Sanders found above. You can modify it in exactly the same way I show here, but you will also have to modify the other output parameters.

25 Apr 2012 JSONlab: a toolbox to encode/decode JSON files in MATLAB/Octave JSONlab is an open-source implementation of a JSON encoder and a decoder/parser for MATLAB/Octave. Author: Qianqian Fang

FYI: for those interested in using Java org.json in MATLAB

Demo:
https://gist.github.com/2492355
git clone git://gist.github.com/2492355.git orgJSONdemo

JSON in Java (org.json):
http://www.json.org/java/index.html

Using Java Collections in Matlab:
http://undocumentedmatlab.com/blog/using-java-collections-in-matlab/

Storing MATLAB structs in Java Objects

Java SE 6 (1.6) API:
http://docs.oracle.com/javase/6/docs/api/

Java HashMap
http://docs.oracle.com/javase/6/docs/api/java/util/HashMap.html

Java ArrayList
http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html

Passing Data to a Java Method:
http://www.mathworks.com/help/techdoc/matlab_external/f6425.html

Handling Data Returned from a Java Method:
http://www.mathworks.com/help/techdoc/matlab_external/f6671.html

Bringing Java Classes and Methods into MATLAB Workspace: Simplifying Java Class Names:
http://www.mathworks.com/help/techdoc/matlab_external/f4863.html#f46341

Working with Java Arrays:
http://www.mathworks.com/help/techdoc/matlab_external/f15351.html

Concatenating Java Objects:
http://www.mathworks.com/help/techdoc/matlab_external/f4873.html#f48488

javaArray:
http://www.mathworks.com/help/techdoc/ref/javaarray.html

24 Apr 2012 JSONlab: a toolbox to encode/decode JSON files in MATLAB/Octave JSONlab is an open-source implementation of a JSON encoder and a decoder/parser for MATLAB/Octave. Author: Qianqian Fang

Thank you Q. Fang for this excellent program. As an alternative anyone could just use the org.json files directly from java. they are here:
https://github.com/douglascrockford/JSON-java
and directions are here:
http://www.json.org/java/index.html
You need to compile them or just export them to a jar file which requires jdk. I have compiled it already for you here:
http://dl.dropbox.com/u/19049582/JSON.jar
Before you can use the org.json library you have to add to your java class path (either dynamic or static) by following the directions here:
http://www.mathworks.com/help/techdoc/matlab_external/f4863.html
For example: javaaddpath('full-path\JSON.jar') will add the jar file to your dynamic path.
Then you can use java which is native to MATLAB to use the org.json library.
For example:
jsonObj = org.json.JSONObject('{myKey:myVal}')

26 Mar 2012 IAPWS_IF97 functional form with no slip Water and steam properties and derivatives based on the IAPWS IF97. Functional form. No slip. Author: Mark Mikofski

until implemented, quality can be calculated from either enthalpy or specific volume and from either psat or Tsat as follows:

x_ph = @(p,h)(h - hL_p(p))./(hV_p(p) - hL_p(p))

then use x = x_ph(p,h)

or:

x_hT = @(h,T)(h - hL_p(psat_T(T)))./(hV_p(psat_T(T)) - hL_p(psat_T(T)))

then use x = x_hT(h,T)

and the very similar for specific volume:

x_pv = @(p,v)(v - vL_p(p))./(vV_p(p) - vL_p(p))

then use x = x_pv(p,v)

or:

x_vT = @(v,T)(v - vL_p(psat_T(T)))./(vV_p(psat_T(T)) - vL_p(psat_T(T)))

then use x = x_vT(h,T)

Comments and Ratings on Mark's Files View all
Updated File Comment by Comments Rating
23 Feb 2013 polyfitZero Fit polynomial to data, forcing y-intercept to zero. Author: Mark Mikofski giga

13 Dec 2012 IAPWS_IF97 functional form with no slip Water and steam properties and derivatives based on the IAPWS IF97. Functional form. No slip. Author: Mark Mikofski Clark, Thomas

Nice vectorisation, thank you for this Mark.

30 May 2012 polyfitZero Fit polynomial to data, forcing y-intercept to zero. Author: Mark Mikofski Mikofski, Mark

John, Sorry for my slow response. You can accomplish this the same way I zeroed out the last coefficient.

E.g. to force the 1st order coefficient to zero do the following:

% ...
x = x(:);
y = y(:);

% since you want might want to include the constant term,
% change "z" to be a matrix of ones, and make it one column wider
% to include the 0th-order term

% z = zeros(dim,degree); % comment out this line which doesn't include constant
z = ones(dim,degree+1); % add this line which now includes 0th-order term

for n = 1:degree
z(:,n) = x.^(degree-n+1);
end

% you don't have to calculate the constant term,
% because it will be a column of ones (i.e. x^0 = 1)
% now remove any columns that you don't want to fit
% e.g. we want to force the 1st order coefficient to zero
orderOfZeroCoeffs = 1; % a vector of terms to omit from regression, e.g. [1,0],
% you could make "orderOfZeroCoeffs" an input to the function

% now, remove the terms whose coeffs you want to zero
orderOfNonZeroCoeffs= ~ismember(degree:-1:0, orderOfZeroCoeffs);
z = z(:,orderOfNonZeroCoeffs); % replace z with the columns removed
% there are a 1000 other ways to write this code!

% comment out the following lines
% because now it's more complicated
% pZero = z\y;
% pZero = [pZero;0]';

% instead create a vector of zeros
% any terms not calculated are already set to zero
pZero = zeros(1,degree+1);
% substitute the coefficients directly into "pZero" by index assignment
pZero(orderOfNonZeroCoeffs) = z\y;

% ...

Try that out. I'm curious what you're using this for. Also check out the other polyfit0 (fex272) function that Jennifer Sanders found above. You can modify it in exactly the same way I show here, but you will also have to modify the other output parameters.

24 May 2012 polyfitZero Fit polynomial to data, forcing y-intercept to zero. Author: Mark Mikofski John

I wonder if you could modify the routine so that higher powers could also be forced to be zero. For example, the current routine set the constant coefficient to zero. But, can the 1st order coefficient also be forced to be zero. And so on...

15 May 2012 IAPWS_IF97 functional form with no slip Water and steam properties and derivatives based on the IAPWS IF97. Functional form. No slip. Author: Mark Mikofski Sugimura, Peter

Top Tags Applied by Mark
modeling, class, data exploration, interpolation, mathematics
Files Tagged by Mark View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
24 Apr 2013 Screenshot JGit4MATLAB JGit4MATLAB is a wrapper for JGit in MATLAB. It is meant to be used from the MATLAB command window. Author: Mark Mikofski git, scm, dvcs, version control, source control manage..., distributed version c... 22 0
18 Apr 2013 Screenshot polyVal2D and polyFit2D Evaluate 2D polynomials using Horner's method. Fit 2D polynomials to data using backslash operator. Author: Mark Mikofski mathematics, optimization, data exploration, interpolation, modeling 66 0
26 Mar 2012 Screenshot IAPWS_IF97 functional form with no slip Water and steam properties and derivatives based on the IAPWS IF97. Functional form. No slip. Author: Mark Mikofski control design, simulation, chemistry, modeling, hydrodynamics, thermodynamics 17 5
  • 4.66667
4.7 | 3 ratings
01 Mar 2012 myDynamicClass Create a set of objects from a text file. Author: Mark Mikofski data import, class, oop, objects 3 1
01 Mar 2012 polyfitZero Fit polynomial to data, forcing y-intercept to zero. Author: Mark Mikofski mathematics, modeling, data exploration, interpolation, polyfit, polyval 34 8
  • 4.33333
4.3 | 3 ratings

Contact us