Code covered by the BSD License  

Highlights from
Units for Matlab

from Units for Matlab by John Kitchin
This package provides units conversion factors and enforces unit algebra for Matlab

test_linsolve
function test_suite = test_linsolve
clear all; clc
initTestSuite;

function test1
u = cmu.units;
a = [[1 0]; [0 1]]*u.m;
b = [3; 4]*u.m/u.s;
x = a\b;
assertEqual(x, [3; 4]/u.s)

function test2
u = cmu.units;
a = [[1 0]; [0 1]]*u.m;
b = [3; 4]*u.m/u.s;
x2 = linsolve(a,b);
assertEqual(x2, [3; 4]/u.s)

Contact us