Category: Matlab
Category Archives: Matlab
ROS toolbox (ROS2 bag)
I would like to read bag files from ROS2 (.db3) format. Is it possible to do it with the current ROS toolbox as the information is serialized into cdr format?I would like to read bag files from ROS2 (.db3) format. Is it possible to do it with the current ROS toolbox as the information is serialized into cdr format? I would like to read bag files from ROS2 (.db3) format. Is it possible to do it with the current ROS toolbox as the information is serialized into cdr format? ros2, bag, rosbag2, ros2bag MATLAB Answers — New Questions
Curve fitter app does not work
I used online MATLAB; however, I could not fit the curve using Curve fitter app.
There are errors presented at the command window as;
Error in matlab.ui.internal.toolstrip.base.ActionInterface>@(event,data)PropertySetCallback(this,event,data) (line 40)
this.PropertySetListener = addlistener(this.Peer, ‘propertySet’, @(event, data) PropertySetCallback(this, event, data));
Error in viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 79)
proxyCallback = @(src, event)callback(src, … > In cfapp.internal.curvefitter.ui.toolstrip/FitSectionView/set.AutoFitState (line 60)
In cfapp.internal.curvefitter.ui.toolstrip/FitSectionView/autoFitRadioButtonClicked (line 138)
In cfapp.internal.curvefitter.ui.toolstrip.FitSectionView>@(varargin)this.autoFitRadioButtonClicked(varargin{:}) (line 116)
In internal.Callback.execute (line 128)
In matlab.ui.internal.toolstrip.base/Action/PropertySetCallback (line 782)
In matlab.ui.internal.toolstrip.base.ActionInterface>@(event,data)PropertySetCallback(this,event,data) (line 40)
In viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 79)I used online MATLAB; however, I could not fit the curve using Curve fitter app.
There are errors presented at the command window as;
Error in matlab.ui.internal.toolstrip.base.ActionInterface>@(event,data)PropertySetCallback(this,event,data) (line 40)
this.PropertySetListener = addlistener(this.Peer, ‘propertySet’, @(event, data) PropertySetCallback(this, event, data));
Error in viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 79)
proxyCallback = @(src, event)callback(src, … > In cfapp.internal.curvefitter.ui.toolstrip/FitSectionView/set.AutoFitState (line 60)
In cfapp.internal.curvefitter.ui.toolstrip/FitSectionView/autoFitRadioButtonClicked (line 138)
In cfapp.internal.curvefitter.ui.toolstrip.FitSectionView>@(varargin)this.autoFitRadioButtonClicked(varargin{:}) (line 116)
In internal.Callback.execute (line 128)
In matlab.ui.internal.toolstrip.base/Action/PropertySetCallback (line 782)
In matlab.ui.internal.toolstrip.base.ActionInterface>@(event,data)PropertySetCallback(this,event,data) (line 40)
In viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 79) I used online MATLAB; however, I could not fit the curve using Curve fitter app.
There are errors presented at the command window as;
Error in matlab.ui.internal.toolstrip.base.ActionInterface>@(event,data)PropertySetCallback(this,event,data) (line 40)
this.PropertySetListener = addlistener(this.Peer, ‘propertySet’, @(event, data) PropertySetCallback(this, event, data));
Error in viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 79)
proxyCallback = @(src, event)callback(src, … > In cfapp.internal.curvefitter.ui.toolstrip/FitSectionView/set.AutoFitState (line 60)
In cfapp.internal.curvefitter.ui.toolstrip/FitSectionView/autoFitRadioButtonClicked (line 138)
In cfapp.internal.curvefitter.ui.toolstrip.FitSectionView>@(varargin)this.autoFitRadioButtonClicked(varargin{:}) (line 116)
In internal.Callback.execute (line 128)
In matlab.ui.internal.toolstrip.base/Action/PropertySetCallback (line 782)
In matlab.ui.internal.toolstrip.base.ActionInterface>@(event,data)PropertySetCallback(this,event,data) (line 40)
In viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 79) error, curve fitting MATLAB Answers — New Questions
I want show ylabel like 36m, 38m, 40m on plot I have variable population, plz help
% Define parameters
PopSaudi22
P_0 = PopSaudi22.POPTOTL % Initial population (1 million)
r = 0.02; % Annual growth rate (2%)
t = 1:1:20; % Time in years from 0 to 50 with a step of 0.1
% Compute population over time
P = P_0 * exp(r * t)
% Plot the result
figure;
plot(t, P,’-o’, ‘LineWidth’, 2);
xlabel(‘Time (years)’);
ylabel(‘Population in million’);
title(‘Exponential Population Growth’);
grid on;
I use an equation this: P = P_0 * exp(r * t)% Define parameters
PopSaudi22
P_0 = PopSaudi22.POPTOTL % Initial population (1 million)
r = 0.02; % Annual growth rate (2%)
t = 1:1:20; % Time in years from 0 to 50 with a step of 0.1
% Compute population over time
P = P_0 * exp(r * t)
% Plot the result
figure;
plot(t, P,’-o’, ‘LineWidth’, 2);
xlabel(‘Time (years)’);
ylabel(‘Population in million’);
title(‘Exponential Population Growth’);
grid on;
I use an equation this: P = P_0 * exp(r * t) % Define parameters
PopSaudi22
P_0 = PopSaudi22.POPTOTL % Initial population (1 million)
r = 0.02; % Annual growth rate (2%)
t = 1:1:20; % Time in years from 0 to 50 with a step of 0.1
% Compute population over time
P = P_0 * exp(r * t)
% Plot the result
figure;
plot(t, P,’-o’, ‘LineWidth’, 2);
xlabel(‘Time (years)’);
ylabel(‘Population in million’);
title(‘Exponential Population Growth’);
grid on;
I use an equation this: P = P_0 * exp(r * t) matlab MATLAB Answers — New Questions
Someone that works with symbolic variables?
Hi guys, I have a code that should give me some results. Unfortunately when I insert k>3, the program collapses and says there isn’t enought RAM to run it. I’m just texting to know if anyone has ever worked with symbolic variables before and can help me. If anyone knows how to work with this please I’ll be really glad to talk to you via email or Telegram.
function [S,Gnew,Enew] = BGroebner1(k)
M = 3*k + 1;
x = sym(‘x’);
r = sym(‘r’);
c = sym(‘c’, [1 M+1]);
% Define the sum of monomials with negative coefficients
CC = x;
for i = 1:M+1
CC = CC + c(1,i)*x^(-i);
end
sM = expand(CC^(3));
for i = M:1:3*M+3
sM = subs(sM, x^(-i), r);
end
sMnew = sM;
sMnew = subs(sMnew,r,0);
sMnew1 = expand(x^(M-1)*sMnew);
C =coeffs(sMnew1,x);
E =sym(‘E’,[1,M-1]);
for i= M-1:-1:1
E(1,M-i) = C(1,i);
end
% Calculate Groebner basis,
num_syms = M+1;
syms_cell = cell(1, num_syms);
for i = M+1:-1:1
syms_cell{i} = sym([‘c’, num2str(M+2-i)]);
end
c = [syms_cell{:}];
G = gbasis(E,c,"MonomialOrder",’Lexicographic’);
J = (M+1)*M;
sM1 = expand(CC^{M});
sMnew2 = expand(x^(J)*sM1);
E2 = coeffs(sMnew2,x);
EM = E2(J);
EM1=E2(J-1);
F= sym(‘F’);
Enew = [E,EM,EM1+F];
% Groebner basis with (E^M)_1, (E^M)_2 + F
Gnew = gbasis(Enew,[F c],"MonomialOrder",’Lexicographic’);
%% Calculate the solutions of the E_{1}, E_{2},…
eqn =sym(‘eqn’, [1 M-1]);
for i=1:1:M-1
eqn(i)= Enew(i)==0;
end
d = sym(‘c’, [1 M+1]);
S = vpasolve(eqn,d);
end
Looking forward your replies.Hi guys, I have a code that should give me some results. Unfortunately when I insert k>3, the program collapses and says there isn’t enought RAM to run it. I’m just texting to know if anyone has ever worked with symbolic variables before and can help me. If anyone knows how to work with this please I’ll be really glad to talk to you via email or Telegram.
function [S,Gnew,Enew] = BGroebner1(k)
M = 3*k + 1;
x = sym(‘x’);
r = sym(‘r’);
c = sym(‘c’, [1 M+1]);
% Define the sum of monomials with negative coefficients
CC = x;
for i = 1:M+1
CC = CC + c(1,i)*x^(-i);
end
sM = expand(CC^(3));
for i = M:1:3*M+3
sM = subs(sM, x^(-i), r);
end
sMnew = sM;
sMnew = subs(sMnew,r,0);
sMnew1 = expand(x^(M-1)*sMnew);
C =coeffs(sMnew1,x);
E =sym(‘E’,[1,M-1]);
for i= M-1:-1:1
E(1,M-i) = C(1,i);
end
% Calculate Groebner basis,
num_syms = M+1;
syms_cell = cell(1, num_syms);
for i = M+1:-1:1
syms_cell{i} = sym([‘c’, num2str(M+2-i)]);
end
c = [syms_cell{:}];
G = gbasis(E,c,"MonomialOrder",’Lexicographic’);
J = (M+1)*M;
sM1 = expand(CC^{M});
sMnew2 = expand(x^(J)*sM1);
E2 = coeffs(sMnew2,x);
EM = E2(J);
EM1=E2(J-1);
F= sym(‘F’);
Enew = [E,EM,EM1+F];
% Groebner basis with (E^M)_1, (E^M)_2 + F
Gnew = gbasis(Enew,[F c],"MonomialOrder",’Lexicographic’);
%% Calculate the solutions of the E_{1}, E_{2},…
eqn =sym(‘eqn’, [1 M-1]);
for i=1:1:M-1
eqn(i)= Enew(i)==0;
end
d = sym(‘c’, [1 M+1]);
S = vpasolve(eqn,d);
end
Looking forward your replies. Hi guys, I have a code that should give me some results. Unfortunately when I insert k>3, the program collapses and says there isn’t enought RAM to run it. I’m just texting to know if anyone has ever worked with symbolic variables before and can help me. If anyone knows how to work with this please I’ll be really glad to talk to you via email or Telegram.
function [S,Gnew,Enew] = BGroebner1(k)
M = 3*k + 1;
x = sym(‘x’);
r = sym(‘r’);
c = sym(‘c’, [1 M+1]);
% Define the sum of monomials with negative coefficients
CC = x;
for i = 1:M+1
CC = CC + c(1,i)*x^(-i);
end
sM = expand(CC^(3));
for i = M:1:3*M+3
sM = subs(sM, x^(-i), r);
end
sMnew = sM;
sMnew = subs(sMnew,r,0);
sMnew1 = expand(x^(M-1)*sMnew);
C =coeffs(sMnew1,x);
E =sym(‘E’,[1,M-1]);
for i= M-1:-1:1
E(1,M-i) = C(1,i);
end
% Calculate Groebner basis,
num_syms = M+1;
syms_cell = cell(1, num_syms);
for i = M+1:-1:1
syms_cell{i} = sym([‘c’, num2str(M+2-i)]);
end
c = [syms_cell{:}];
G = gbasis(E,c,"MonomialOrder",’Lexicographic’);
J = (M+1)*M;
sM1 = expand(CC^{M});
sMnew2 = expand(x^(J)*sM1);
E2 = coeffs(sMnew2,x);
EM = E2(J);
EM1=E2(J-1);
F= sym(‘F’);
Enew = [E,EM,EM1+F];
% Groebner basis with (E^M)_1, (E^M)_2 + F
Gnew = gbasis(Enew,[F c],"MonomialOrder",’Lexicographic’);
%% Calculate the solutions of the E_{1}, E_{2},…
eqn =sym(‘eqn’, [1 M-1]);
for i=1:1:M-1
eqn(i)= Enew(i)==0;
end
d = sym(‘c’, [1 M+1]);
S = vpasolve(eqn,d);
end
Looking forward your replies. symbolic, variables MATLAB Answers — New Questions
using polyval with one of the polynomials of a spline obtained with the unmkpp command, the results do not overlap! Why?
I first interpolated some data using the spline command. Then I calculated the coefficients of the different cubic polynomials that make up the spline. Then I used the polyval command to check the first polynomial but the spline and polyval curves do not overlap.
What am I doing wrong?.
There is definitely something related to the various polynomials that I have not understood correctly. I thank anyone who helps me understand better. See the file script please:
%butta_sto_test
%
clear all
clc
% Data
% Time
Time=[7, 9, 11, 12]
% Temperture
Temperature=[49, 57, 71, 75]
% Data Time query
Timeq=[7:0.1:12];
% Results
% piecewise polynomial structure
pp=spline(Time, Temperature);
% Timeq data interpolation
Temperatureq=spline(Time, Temperature, Timeq);
% Calculating the coefficients of the 3 polynomials that make up the spline
[breaks, coeffs, m, n] = unmkpp(spline(Time,Temperature));
% First polinomial p1
p1=coeffs(1,:)
% First time interval corresponding to the first polynomial of the spline
Timeq1=[7:0.1:9];
% using polyval to calculate the values corresponding to Timeq1 using the polynomial p1
Temperatureq1=polyval(p1,Timeq1);
% Spline plot
figure(1)
plot(Timeq, Temperatureq, Time, Temperature, ‘o’, Time, Temperature, ‘–‘)
hold on
plot(Timeq1, Temperatureq1,’*’)
grid onI first interpolated some data using the spline command. Then I calculated the coefficients of the different cubic polynomials that make up the spline. Then I used the polyval command to check the first polynomial but the spline and polyval curves do not overlap.
What am I doing wrong?.
There is definitely something related to the various polynomials that I have not understood correctly. I thank anyone who helps me understand better. See the file script please:
%butta_sto_test
%
clear all
clc
% Data
% Time
Time=[7, 9, 11, 12]
% Temperture
Temperature=[49, 57, 71, 75]
% Data Time query
Timeq=[7:0.1:12];
% Results
% piecewise polynomial structure
pp=spline(Time, Temperature);
% Timeq data interpolation
Temperatureq=spline(Time, Temperature, Timeq);
% Calculating the coefficients of the 3 polynomials that make up the spline
[breaks, coeffs, m, n] = unmkpp(spline(Time,Temperature));
% First polinomial p1
p1=coeffs(1,:)
% First time interval corresponding to the first polynomial of the spline
Timeq1=[7:0.1:9];
% using polyval to calculate the values corresponding to Timeq1 using the polynomial p1
Temperatureq1=polyval(p1,Timeq1);
% Spline plot
figure(1)
plot(Timeq, Temperatureq, Time, Temperature, ‘o’, Time, Temperature, ‘–‘)
hold on
plot(Timeq1, Temperatureq1,’*’)
grid on I first interpolated some data using the spline command. Then I calculated the coefficients of the different cubic polynomials that make up the spline. Then I used the polyval command to check the first polynomial but the spline and polyval curves do not overlap.
What am I doing wrong?.
There is definitely something related to the various polynomials that I have not understood correctly. I thank anyone who helps me understand better. See the file script please:
%butta_sto_test
%
clear all
clc
% Data
% Time
Time=[7, 9, 11, 12]
% Temperture
Temperature=[49, 57, 71, 75]
% Data Time query
Timeq=[7:0.1:12];
% Results
% piecewise polynomial structure
pp=spline(Time, Temperature);
% Timeq data interpolation
Temperatureq=spline(Time, Temperature, Timeq);
% Calculating the coefficients of the 3 polynomials that make up the spline
[breaks, coeffs, m, n] = unmkpp(spline(Time,Temperature));
% First polinomial p1
p1=coeffs(1,:)
% First time interval corresponding to the first polynomial of the spline
Timeq1=[7:0.1:9];
% using polyval to calculate the values corresponding to Timeq1 using the polynomial p1
Temperatureq1=polyval(p1,Timeq1);
% Spline plot
figure(1)
plot(Timeq, Temperatureq, Time, Temperature, ‘o’, Time, Temperature, ‘–‘)
hold on
plot(Timeq1, Temperatureq1,’*’)
grid on spline unmkpp polyval interpolation MATLAB Answers — New Questions
Please tell me what corrections can I make when encountering the following error?
[X, Y, T] = ndgrid(xspan, yspan, tspan0);
R_pre = interpn(X, Y, T, u_history, x, y, tref, ‘linear’);
Incorrect use of griddedInterpolant.
GridVectors must define grids whose size is compatible with the Values array.[X, Y, T] = ndgrid(xspan, yspan, tspan0);
R_pre = interpn(X, Y, T, u_history, x, y, tref, ‘linear’);
Incorrect use of griddedInterpolant.
GridVectors must define grids whose size is compatible with the Values array. [X, Y, T] = ndgrid(xspan, yspan, tspan0);
R_pre = interpn(X, Y, T, u_history, x, y, tref, ‘linear’);
Incorrect use of griddedInterpolant.
GridVectors must define grids whose size is compatible with the Values array. transferred MATLAB Answers — New Questions
Image Representation conversion to functional array
I want to be able to convert a set of image representations of wing venation patterns to a multiple array format.
For each wing vein, the array needs to include
L, h = xy coordinate for the start of the vein
vt = the thickness of the vein
Lf, hf = xy coordinate for the end of the vein
R = rough aggregate radius of the arc of the vein.
For each cross-vein, the array needs to include
L1% = the starting x position of the connecting cross-vein
L2% = the finishing x position of the connecting cross-vein
ct = thickness of the cross vein
The total array is about 69 values long with it being split into a 7×6 and 3×9 array for vein and cross-vein properties respectively.
I’ve had some success with the reverse of this (taking an encoded array and converting that into an image representation, attached below with an example of one of the images that will be used).
%% Define the vein and cross_vein arrays
asydentus.vein = [1.25 25 2 92.5 29.5 39.47041396 ; 2.25 27.5 3 43.75 16.5 -14.73949649 ; 13.75 29.5 1 71.25 21 -33.2551027 ; 13.75 29.5 1 86.75 26.5 -79.65111699 ; 10 37.5 2 74.5 58.5 43.17494694 ; 10 37.5 2 63 93 17.18991587 ; 10 37.5 1 25 72.5 4.144372635];
asydentus.cross_vein = [13.25 15 2 ; 0 0 0 ; 0 0 0 ; 25.25 26.75 2 ; 30.75 30.5 2 ; 20.5 19.25 2 ; 0 0 0 ; 0 0 0 ; 0 0 0];
% Scaling factors
sf1 = 4;
sf2 = -2;
sf3 = 20;
%% Define startpoints and endpoints for veins and cross-veins and define radius for veins
vein1.p1 = [sf1 * asydentus.vein(1,1), sf2 * asydentus.vein(1,2)]; % vein 1 startpoint
vein1.p2 = [sf1 * asydentus.vein(1,4), sf2 * asydentus.vein(1,5)]; % vein 1 endpoint
vein1.r = sf3 * [asydentus.vein(1,6)]; % vein 1 radius value
vein2.p1 = [sf1 * asydentus.vein(2,1), sf2 * asydentus.vein(2,2)]; % vein 2 startpoint
vein2.p2 = [sf1 * asydentus.vein(2,4), sf2 * asydentus.vein(2,5)]; % vein 2 endpoint
vein2.r = sf3 * [asydentus.vein(2,6)]; % vein 2 radius value
vein3.p1 = [sf1 * asydentus.vein(3,1), sf2 * asydentus.vein(3,2)]; % vein 3 startpoint
vein3.p2 = [sf1 * asydentus.vein(3,4), sf2 * asydentus.vein(3,5)]; % vein 3 endpoint
vein3.r = sf3 * [asydentus.vein(3,6)]; % vein 3 radius value
vein4.p1 = [sf1 * asydentus.vein(4,1), sf2 * asydentus.vein(4,2)]; % vein 4 startpoint
vein4.p2 = [sf1 * asydentus.vein(4,4), sf2 * asydentus.vein(4,5)]; % vein 4 endpoint
vein4.r = sf3 * [asydentus.vein(4,6)]; % vein 4 radius value
vein5.p1 = [sf1 * asydentus.vein(5,1), sf2 * asydentus.vein(5,2)]; % vein 5 startpoint
vein5.p2 = [sf1 * asydentus.vein(5,4), sf2 * asydentus.vein(5,5)]; % vein 5 endpoint
vein5.r = sf3 * [asydentus.vein(5,6)]; % vein 5 radius value
vein6.p1 = [sf1 * asydentus.vein(6,1), sf2 * asydentus.vein(6,2)]; % vein 6 startpoint
vein6.p2 = [sf1 * asydentus.vein(6,4), sf2 * asydentus.vein(6,5)]; % vein 6 endpoint
vein6.r = sf3 * [asydentus.vein(6,6)]; % vein 6 radius value
vein7.p1 = [sf1 * asydentus.vein(7,1), sf2 * asydentus.vein(7,2)]; % vein 7 startpoint
vein7.p2 = [sf1 * asydentus.vein(7,4), sf2 * asydentus.vein(7,5)]; % vein 7 endpoint
vein7.r = sf3 * [asydentus.vein(7,6)]; % vein 7 radius value
crossvein1.x1 = sf1 * [asydentus.cross_vein(1,1)]; % crossvein 1 start x-coordinate
crossvein1.x2 = sf1 * [asydentus.cross_vein(1,2)]; % crossvein 1 end x-coordinate
crossvein4.x1 = sf1 * [asydentus.cross_vein(4,1)]; % crossvein 4 start x-coordinate
crossvein4.x2 = sf1 * [asydentus.cross_vein(4,2)]; % crossvein 4 end x-coordinate
crossvein5.x1 = sf1 * [asydentus.cross_vein(5,1)]; % crossvein 5 start x-coordinate
crossvein5.x2 = sf1 * [asydentus.cross_vein(5,2)]; % crossvein 5 end x-coordinate
crossvein6.x1 = sf1 * [asydentus.cross_vein(6,1)]; % crossvein 6 start x-coordinate
crossvein6.x2 = sf1 * [asydentus.cross_vein(6,1)]; % crossvein 6 end x-coordinate
%% Solve for centre of radius and cross-vein coordinates
syms x1 y1
[x1, y1] = solve((x1-vein1.p1(1))^2+(y1-vein1.p1(2))^2==vein1.r^2, (x1-vein1.p2(1))^2+(y1-vein1.p2(2))^2==vein1.r^2, x1, y1);
% vein 1 centre of radius
arc1_c1 = double([x1(1), y1(1)]);
arc1_c2 = double([x1(2), y1(2)]);
syms x2 y2
[x2, y2] = solve((x2-vein2.p1(1))^2+(y2-vein2.p1(2))^2==vein2.r^2, (x2-vein2.p2(1))^2+(y2-vein2.p2(2))^2==vein2.r^2, x2, y2);
% vein 2 centre of radius
arc2_c1 = double([x2(1), y2(1)]);
arc2_c2 = double([x2(2), y2(2)]);
syms x3 y3
[x3, y3] = solve((x3-vein3.p1(1))^2+(y3-vein3.p1(2))^2==vein3.r^2, (x3-vein3.p2(1))^2+(y3-vein3.p2(2))^2==vein3.r^2, x3, y3);
% vein 3 centre of radius
arc3_c1 = double([x3(1), y3(1)]);
arc3_c2 = double([x3(2), y3(2)]);
syms x4 y4
[x4, y4] = solve((x4-vein4.p1(1))^2+(y4-vein4.p1(2))^2==vein4.r^2, (x4-vein4.p2(1))^2+(y4-vein4.p2(2))^2==vein4.r^2, x4, y4);
% vein 4 centre of radius
arc4_c1 = double([x4(1), y4(1)]);
arc4_c2 = double([x4(2), y4(2)]);
syms x5 y5
[x5, y5] = solve((x5-vein5.p1(1))^2+(y5-vein5.p1(2))^2==vein5.r^2, (x5-vein5.p2(1))^2+(y5-vein5.p2(2))^2==vein5.r^2, x5, y5);
% vein 5 centre of radius
arc5_c1 = double([x5(1), y5(1)]);
arc5_c2 = double([x5(2), y5(2)]);
syms x6 y6
[x6, y6] = solve((x6-vein6.p1(1))^2+(y6-vein6.p1(2))^2==vein6.r^2, (x6-vein6.p2(1))^2+(y6-vein6.p2(2))^2==vein6.r^2, x6, y6);
% vein 6 centre of radius
arc6_c1 = double([x6(1), y6(1)]);
arc6_c2 = double([x6(2), y6(2)]);
syms x7 y7
[x7, y7] = solve((x7-vein7.p1(1))^2+(y7-vein7.p1(2))^2==vein7.r^2, (x7-vein7.p2(1))^2+(y7-vein7.p2(2))^2==vein7.r^2, x7, y7);
% vein 7 centre of radius
arc7_c1 = double([x7(1), y7(1)]);
arc7_c2 = double([x7(2), y7(2)]);
syms yc1_1
[yc1_1] = solve ((crossvein1.x1(1) – arc1_c1(1)).^2 + (yc1_1 – arc1_c1(2)).^2 – vein1.r^2, (-200<=yc1_1)<=0);
crossvein1.y1 = yc1_1;
syms yc1_2
[yc1_2] = solve ((crossvein1.x2(1) – arc2_c2(1)).^2 + (yc1_2 – arc2_c2(2)).^2 – vein2.r^2, (-200<=yc1_2)<=0);
crossvein1.y2 = yc1_2;
syms yc4_1
[yc4_1] = solve ((crossvein4.x1(1) – arc4_c2(1)).^2 + (yc4_1 – arc4_c2(2)).^2 – vein4.r^2, (-200<=yc4_1)<=0);
crossvein4.y1 = yc4_1;
syms yc4_2
[yc4_2] = solve ((crossvein4.x2(1) – arc5_c1(1)).^2 + (yc4_2 – arc5_c1(2)).^2 – vein5.r^2, (-200<=yc4_2)<=0);
crossvein4.y2 = yc4_2;
syms yc5_1
[yc5_1] = solve ((crossvein5.x1(1) – arc5_c1(1)).^2 + (yc5_1 – arc5_c1(2)).^2 – vein5.r^2, (-200<=yc5_1)<=0);
crossvein5.y1 = yc5_1;
syms yc5_2
[yc5_2] = solve ((crossvein5.x2(1) – arc6_c1(1)).^2 + (yc5_2 – arc6_c1(2)).^2 – vein6.r^2, (-200<=yc5_2)<=0);
crossvein5.y2 = yc5_2;
syms yc6_1
[yc6_1] = solve ((crossvein6.x1(1) – arc6_c1(1)).^2 + (yc6_1 – arc6_c1(2)).^2 – vein6.r^2, (-200<=yc6_1)<=0);
crossvein6.y1 = yc6_1;
syms yc6_2
[yc6_2] = solve ((crossvein6.x2(1) – arc7_c1(1)).^2 + (yc6_2 – arc7_c1(2)).^2 – vein7.r^2, (-200<=yc6_2)<=0);
crossvein6.y2 = yc6_2;
%% Define Arc Function for vein radius
figure;
hold on;
% Define the implicit functions for the circles
f1_1 = @(X1, Y1) (X1 – arc1_c1(1)).^2 + (Y1 – arc1_c1(2)).^2 – vein1.r^2;
f1_2 = @(X1, Y1) (X1 – arc1_c2(1)).^2 + (Y1 – arc1_c2(2)).^2 – vein1.r^2;
f2_1 = @(X2, Y2) (X2 – arc2_c1(1)).^2 + (Y2 – arc2_c1(2)).^2 – vein2.r^2;
f2_2 = @(X2, Y2) (X2 – arc2_c2(1)).^2 + (Y2 – arc2_c2(2)).^2 – vein2.r^2;
f3_1 = @(X3, Y3) (X3 – arc3_c1(1)).^2 + (Y3 – arc3_c1(2)).^2 – vein3.r^2;
f3_2 = @(X3, Y3) (X3 – arc3_c2(1)).^2 + (Y3 – arc3_c2(2)).^2 – vein3.r^2;
f4_1 = @(X4, Y4) (X4 – arc4_c1(1)).^2 + (Y4 – arc4_c1(2)).^2 – vein4.r^2;
f4_2 = @(X4, Y4) (X4 – arc4_c2(1)).^2 + (Y4 – arc4_c2(2)).^2 – vein4.r^2;
f5_1 = @(X5, Y5) (X5 – arc5_c1(1)).^2 + (Y5 – arc5_c1(2)).^2 – vein5.r^2;
f5_2 = @(X5, Y5) (X5 – arc5_c2(1)).^2 + (Y5 – arc5_c2(2)).^2 – vein5.r^2;
f6_1 = @(X6, Y6) (X6 – arc6_c1(1)).^2 + (Y6 – arc6_c1(2)).^2 – vein6.r^2;
f6_2 = @(X6, Y6) (X6 – arc6_c2(1)).^2 + (Y6 – arc6_c2(2)).^2 – vein6.r^2;
f7_1 = @(X7, Y7) (X7 – arc7_c1(1)).^2 + (Y7 – arc7_c1(2)).^2 – vein7.r^2;
f7_2 = @(X7, Y7) (X7 – arc7_c2(1)).^2 + (Y7 – arc7_c2(2)).^2 – vein7.r^2;
%% Plot the veins and cross-veins using fimplicit
% Depending on whether the arc of the vein is 0<=180 or 180<=360 will
% decide which implicit function is used
% use image representations as a guide
t = [1; 2; 3]; % Line Thickness
fimplicit(f1_1, [5 370 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f1_2, [5 370 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed
%fimplicit(f2_1, [9 175 -200 0], ‘LineWidth’, t(3) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
fimplicit(f2_2, [9 175 -200 0], ‘LineWidth’, t(3) , ‘Color’, ‘k’); % Adjust LineWidth as needed
%fimplicit(f3_1, [55 285 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
fimplicit(f3_2, [55 285 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed
%fimplicit(f4_1, [55 347 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
fimplicit(f4_2, [55 347 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed
fimplicit(f5_1, [40 298 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f5_2, [40 298 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed
fimplicit(f6_1, [40 252 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f6_2, [40 252 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed
fimplicit(f7_1, [40 100 -160 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f7_2, [40 100 -160 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed
plot([crossvein1.x1 crossvein1.x2], [crossvein1.y1 crossvein1.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
plot([crossvein4.x1 crossvein4.x2], [crossvein4.y1 crossvein4.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
plot([crossvein5.x1 crossvein5.x2], [crossvein5.y1 crossvein5.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
plot([crossvein6.x1 crossvein6.x2], [crossvein6.y1 crossvein6.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
% Plot settings
axis([0 400 -200 0]);
xlabel(‘X’);
ylabel(‘Y’);
title(‘Asydentus Venation’);
hold off;I want to be able to convert a set of image representations of wing venation patterns to a multiple array format.
For each wing vein, the array needs to include
L, h = xy coordinate for the start of the vein
vt = the thickness of the vein
Lf, hf = xy coordinate for the end of the vein
R = rough aggregate radius of the arc of the vein.
For each cross-vein, the array needs to include
L1% = the starting x position of the connecting cross-vein
L2% = the finishing x position of the connecting cross-vein
ct = thickness of the cross vein
The total array is about 69 values long with it being split into a 7×6 and 3×9 array for vein and cross-vein properties respectively.
I’ve had some success with the reverse of this (taking an encoded array and converting that into an image representation, attached below with an example of one of the images that will be used).
%% Define the vein and cross_vein arrays
asydentus.vein = [1.25 25 2 92.5 29.5 39.47041396 ; 2.25 27.5 3 43.75 16.5 -14.73949649 ; 13.75 29.5 1 71.25 21 -33.2551027 ; 13.75 29.5 1 86.75 26.5 -79.65111699 ; 10 37.5 2 74.5 58.5 43.17494694 ; 10 37.5 2 63 93 17.18991587 ; 10 37.5 1 25 72.5 4.144372635];
asydentus.cross_vein = [13.25 15 2 ; 0 0 0 ; 0 0 0 ; 25.25 26.75 2 ; 30.75 30.5 2 ; 20.5 19.25 2 ; 0 0 0 ; 0 0 0 ; 0 0 0];
% Scaling factors
sf1 = 4;
sf2 = -2;
sf3 = 20;
%% Define startpoints and endpoints for veins and cross-veins and define radius for veins
vein1.p1 = [sf1 * asydentus.vein(1,1), sf2 * asydentus.vein(1,2)]; % vein 1 startpoint
vein1.p2 = [sf1 * asydentus.vein(1,4), sf2 * asydentus.vein(1,5)]; % vein 1 endpoint
vein1.r = sf3 * [asydentus.vein(1,6)]; % vein 1 radius value
vein2.p1 = [sf1 * asydentus.vein(2,1), sf2 * asydentus.vein(2,2)]; % vein 2 startpoint
vein2.p2 = [sf1 * asydentus.vein(2,4), sf2 * asydentus.vein(2,5)]; % vein 2 endpoint
vein2.r = sf3 * [asydentus.vein(2,6)]; % vein 2 radius value
vein3.p1 = [sf1 * asydentus.vein(3,1), sf2 * asydentus.vein(3,2)]; % vein 3 startpoint
vein3.p2 = [sf1 * asydentus.vein(3,4), sf2 * asydentus.vein(3,5)]; % vein 3 endpoint
vein3.r = sf3 * [asydentus.vein(3,6)]; % vein 3 radius value
vein4.p1 = [sf1 * asydentus.vein(4,1), sf2 * asydentus.vein(4,2)]; % vein 4 startpoint
vein4.p2 = [sf1 * asydentus.vein(4,4), sf2 * asydentus.vein(4,5)]; % vein 4 endpoint
vein4.r = sf3 * [asydentus.vein(4,6)]; % vein 4 radius value
vein5.p1 = [sf1 * asydentus.vein(5,1), sf2 * asydentus.vein(5,2)]; % vein 5 startpoint
vein5.p2 = [sf1 * asydentus.vein(5,4), sf2 * asydentus.vein(5,5)]; % vein 5 endpoint
vein5.r = sf3 * [asydentus.vein(5,6)]; % vein 5 radius value
vein6.p1 = [sf1 * asydentus.vein(6,1), sf2 * asydentus.vein(6,2)]; % vein 6 startpoint
vein6.p2 = [sf1 * asydentus.vein(6,4), sf2 * asydentus.vein(6,5)]; % vein 6 endpoint
vein6.r = sf3 * [asydentus.vein(6,6)]; % vein 6 radius value
vein7.p1 = [sf1 * asydentus.vein(7,1), sf2 * asydentus.vein(7,2)]; % vein 7 startpoint
vein7.p2 = [sf1 * asydentus.vein(7,4), sf2 * asydentus.vein(7,5)]; % vein 7 endpoint
vein7.r = sf3 * [asydentus.vein(7,6)]; % vein 7 radius value
crossvein1.x1 = sf1 * [asydentus.cross_vein(1,1)]; % crossvein 1 start x-coordinate
crossvein1.x2 = sf1 * [asydentus.cross_vein(1,2)]; % crossvein 1 end x-coordinate
crossvein4.x1 = sf1 * [asydentus.cross_vein(4,1)]; % crossvein 4 start x-coordinate
crossvein4.x2 = sf1 * [asydentus.cross_vein(4,2)]; % crossvein 4 end x-coordinate
crossvein5.x1 = sf1 * [asydentus.cross_vein(5,1)]; % crossvein 5 start x-coordinate
crossvein5.x2 = sf1 * [asydentus.cross_vein(5,2)]; % crossvein 5 end x-coordinate
crossvein6.x1 = sf1 * [asydentus.cross_vein(6,1)]; % crossvein 6 start x-coordinate
crossvein6.x2 = sf1 * [asydentus.cross_vein(6,1)]; % crossvein 6 end x-coordinate
%% Solve for centre of radius and cross-vein coordinates
syms x1 y1
[x1, y1] = solve((x1-vein1.p1(1))^2+(y1-vein1.p1(2))^2==vein1.r^2, (x1-vein1.p2(1))^2+(y1-vein1.p2(2))^2==vein1.r^2, x1, y1);
% vein 1 centre of radius
arc1_c1 = double([x1(1), y1(1)]);
arc1_c2 = double([x1(2), y1(2)]);
syms x2 y2
[x2, y2] = solve((x2-vein2.p1(1))^2+(y2-vein2.p1(2))^2==vein2.r^2, (x2-vein2.p2(1))^2+(y2-vein2.p2(2))^2==vein2.r^2, x2, y2);
% vein 2 centre of radius
arc2_c1 = double([x2(1), y2(1)]);
arc2_c2 = double([x2(2), y2(2)]);
syms x3 y3
[x3, y3] = solve((x3-vein3.p1(1))^2+(y3-vein3.p1(2))^2==vein3.r^2, (x3-vein3.p2(1))^2+(y3-vein3.p2(2))^2==vein3.r^2, x3, y3);
% vein 3 centre of radius
arc3_c1 = double([x3(1), y3(1)]);
arc3_c2 = double([x3(2), y3(2)]);
syms x4 y4
[x4, y4] = solve((x4-vein4.p1(1))^2+(y4-vein4.p1(2))^2==vein4.r^2, (x4-vein4.p2(1))^2+(y4-vein4.p2(2))^2==vein4.r^2, x4, y4);
% vein 4 centre of radius
arc4_c1 = double([x4(1), y4(1)]);
arc4_c2 = double([x4(2), y4(2)]);
syms x5 y5
[x5, y5] = solve((x5-vein5.p1(1))^2+(y5-vein5.p1(2))^2==vein5.r^2, (x5-vein5.p2(1))^2+(y5-vein5.p2(2))^2==vein5.r^2, x5, y5);
% vein 5 centre of radius
arc5_c1 = double([x5(1), y5(1)]);
arc5_c2 = double([x5(2), y5(2)]);
syms x6 y6
[x6, y6] = solve((x6-vein6.p1(1))^2+(y6-vein6.p1(2))^2==vein6.r^2, (x6-vein6.p2(1))^2+(y6-vein6.p2(2))^2==vein6.r^2, x6, y6);
% vein 6 centre of radius
arc6_c1 = double([x6(1), y6(1)]);
arc6_c2 = double([x6(2), y6(2)]);
syms x7 y7
[x7, y7] = solve((x7-vein7.p1(1))^2+(y7-vein7.p1(2))^2==vein7.r^2, (x7-vein7.p2(1))^2+(y7-vein7.p2(2))^2==vein7.r^2, x7, y7);
% vein 7 centre of radius
arc7_c1 = double([x7(1), y7(1)]);
arc7_c2 = double([x7(2), y7(2)]);
syms yc1_1
[yc1_1] = solve ((crossvein1.x1(1) – arc1_c1(1)).^2 + (yc1_1 – arc1_c1(2)).^2 – vein1.r^2, (-200<=yc1_1)<=0);
crossvein1.y1 = yc1_1;
syms yc1_2
[yc1_2] = solve ((crossvein1.x2(1) – arc2_c2(1)).^2 + (yc1_2 – arc2_c2(2)).^2 – vein2.r^2, (-200<=yc1_2)<=0);
crossvein1.y2 = yc1_2;
syms yc4_1
[yc4_1] = solve ((crossvein4.x1(1) – arc4_c2(1)).^2 + (yc4_1 – arc4_c2(2)).^2 – vein4.r^2, (-200<=yc4_1)<=0);
crossvein4.y1 = yc4_1;
syms yc4_2
[yc4_2] = solve ((crossvein4.x2(1) – arc5_c1(1)).^2 + (yc4_2 – arc5_c1(2)).^2 – vein5.r^2, (-200<=yc4_2)<=0);
crossvein4.y2 = yc4_2;
syms yc5_1
[yc5_1] = solve ((crossvein5.x1(1) – arc5_c1(1)).^2 + (yc5_1 – arc5_c1(2)).^2 – vein5.r^2, (-200<=yc5_1)<=0);
crossvein5.y1 = yc5_1;
syms yc5_2
[yc5_2] = solve ((crossvein5.x2(1) – arc6_c1(1)).^2 + (yc5_2 – arc6_c1(2)).^2 – vein6.r^2, (-200<=yc5_2)<=0);
crossvein5.y2 = yc5_2;
syms yc6_1
[yc6_1] = solve ((crossvein6.x1(1) – arc6_c1(1)).^2 + (yc6_1 – arc6_c1(2)).^2 – vein6.r^2, (-200<=yc6_1)<=0);
crossvein6.y1 = yc6_1;
syms yc6_2
[yc6_2] = solve ((crossvein6.x2(1) – arc7_c1(1)).^2 + (yc6_2 – arc7_c1(2)).^2 – vein7.r^2, (-200<=yc6_2)<=0);
crossvein6.y2 = yc6_2;
%% Define Arc Function for vein radius
figure;
hold on;
% Define the implicit functions for the circles
f1_1 = @(X1, Y1) (X1 – arc1_c1(1)).^2 + (Y1 – arc1_c1(2)).^2 – vein1.r^2;
f1_2 = @(X1, Y1) (X1 – arc1_c2(1)).^2 + (Y1 – arc1_c2(2)).^2 – vein1.r^2;
f2_1 = @(X2, Y2) (X2 – arc2_c1(1)).^2 + (Y2 – arc2_c1(2)).^2 – vein2.r^2;
f2_2 = @(X2, Y2) (X2 – arc2_c2(1)).^2 + (Y2 – arc2_c2(2)).^2 – vein2.r^2;
f3_1 = @(X3, Y3) (X3 – arc3_c1(1)).^2 + (Y3 – arc3_c1(2)).^2 – vein3.r^2;
f3_2 = @(X3, Y3) (X3 – arc3_c2(1)).^2 + (Y3 – arc3_c2(2)).^2 – vein3.r^2;
f4_1 = @(X4, Y4) (X4 – arc4_c1(1)).^2 + (Y4 – arc4_c1(2)).^2 – vein4.r^2;
f4_2 = @(X4, Y4) (X4 – arc4_c2(1)).^2 + (Y4 – arc4_c2(2)).^2 – vein4.r^2;
f5_1 = @(X5, Y5) (X5 – arc5_c1(1)).^2 + (Y5 – arc5_c1(2)).^2 – vein5.r^2;
f5_2 = @(X5, Y5) (X5 – arc5_c2(1)).^2 + (Y5 – arc5_c2(2)).^2 – vein5.r^2;
f6_1 = @(X6, Y6) (X6 – arc6_c1(1)).^2 + (Y6 – arc6_c1(2)).^2 – vein6.r^2;
f6_2 = @(X6, Y6) (X6 – arc6_c2(1)).^2 + (Y6 – arc6_c2(2)).^2 – vein6.r^2;
f7_1 = @(X7, Y7) (X7 – arc7_c1(1)).^2 + (Y7 – arc7_c1(2)).^2 – vein7.r^2;
f7_2 = @(X7, Y7) (X7 – arc7_c2(1)).^2 + (Y7 – arc7_c2(2)).^2 – vein7.r^2;
%% Plot the veins and cross-veins using fimplicit
% Depending on whether the arc of the vein is 0<=180 or 180<=360 will
% decide which implicit function is used
% use image representations as a guide
t = [1; 2; 3]; % Line Thickness
fimplicit(f1_1, [5 370 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f1_2, [5 370 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed
%fimplicit(f2_1, [9 175 -200 0], ‘LineWidth’, t(3) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
fimplicit(f2_2, [9 175 -200 0], ‘LineWidth’, t(3) , ‘Color’, ‘k’); % Adjust LineWidth as needed
%fimplicit(f3_1, [55 285 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
fimplicit(f3_2, [55 285 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed
%fimplicit(f4_1, [55 347 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
fimplicit(f4_2, [55 347 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed
fimplicit(f5_1, [40 298 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f5_2, [40 298 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed
fimplicit(f6_1, [40 252 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f6_2, [40 252 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed
fimplicit(f7_1, [40 100 -160 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f7_2, [40 100 -160 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed
plot([crossvein1.x1 crossvein1.x2], [crossvein1.y1 crossvein1.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
plot([crossvein4.x1 crossvein4.x2], [crossvein4.y1 crossvein4.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
plot([crossvein5.x1 crossvein5.x2], [crossvein5.y1 crossvein5.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
plot([crossvein6.x1 crossvein6.x2], [crossvein6.y1 crossvein6.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
% Plot settings
axis([0 400 -200 0]);
xlabel(‘X’);
ylabel(‘Y’);
title(‘Asydentus Venation’);
hold off; I want to be able to convert a set of image representations of wing venation patterns to a multiple array format.
For each wing vein, the array needs to include
L, h = xy coordinate for the start of the vein
vt = the thickness of the vein
Lf, hf = xy coordinate for the end of the vein
R = rough aggregate radius of the arc of the vein.
For each cross-vein, the array needs to include
L1% = the starting x position of the connecting cross-vein
L2% = the finishing x position of the connecting cross-vein
ct = thickness of the cross vein
The total array is about 69 values long with it being split into a 7×6 and 3×9 array for vein and cross-vein properties respectively.
I’ve had some success with the reverse of this (taking an encoded array and converting that into an image representation, attached below with an example of one of the images that will be used).
%% Define the vein and cross_vein arrays
asydentus.vein = [1.25 25 2 92.5 29.5 39.47041396 ; 2.25 27.5 3 43.75 16.5 -14.73949649 ; 13.75 29.5 1 71.25 21 -33.2551027 ; 13.75 29.5 1 86.75 26.5 -79.65111699 ; 10 37.5 2 74.5 58.5 43.17494694 ; 10 37.5 2 63 93 17.18991587 ; 10 37.5 1 25 72.5 4.144372635];
asydentus.cross_vein = [13.25 15 2 ; 0 0 0 ; 0 0 0 ; 25.25 26.75 2 ; 30.75 30.5 2 ; 20.5 19.25 2 ; 0 0 0 ; 0 0 0 ; 0 0 0];
% Scaling factors
sf1 = 4;
sf2 = -2;
sf3 = 20;
%% Define startpoints and endpoints for veins and cross-veins and define radius for veins
vein1.p1 = [sf1 * asydentus.vein(1,1), sf2 * asydentus.vein(1,2)]; % vein 1 startpoint
vein1.p2 = [sf1 * asydentus.vein(1,4), sf2 * asydentus.vein(1,5)]; % vein 1 endpoint
vein1.r = sf3 * [asydentus.vein(1,6)]; % vein 1 radius value
vein2.p1 = [sf1 * asydentus.vein(2,1), sf2 * asydentus.vein(2,2)]; % vein 2 startpoint
vein2.p2 = [sf1 * asydentus.vein(2,4), sf2 * asydentus.vein(2,5)]; % vein 2 endpoint
vein2.r = sf3 * [asydentus.vein(2,6)]; % vein 2 radius value
vein3.p1 = [sf1 * asydentus.vein(3,1), sf2 * asydentus.vein(3,2)]; % vein 3 startpoint
vein3.p2 = [sf1 * asydentus.vein(3,4), sf2 * asydentus.vein(3,5)]; % vein 3 endpoint
vein3.r = sf3 * [asydentus.vein(3,6)]; % vein 3 radius value
vein4.p1 = [sf1 * asydentus.vein(4,1), sf2 * asydentus.vein(4,2)]; % vein 4 startpoint
vein4.p2 = [sf1 * asydentus.vein(4,4), sf2 * asydentus.vein(4,5)]; % vein 4 endpoint
vein4.r = sf3 * [asydentus.vein(4,6)]; % vein 4 radius value
vein5.p1 = [sf1 * asydentus.vein(5,1), sf2 * asydentus.vein(5,2)]; % vein 5 startpoint
vein5.p2 = [sf1 * asydentus.vein(5,4), sf2 * asydentus.vein(5,5)]; % vein 5 endpoint
vein5.r = sf3 * [asydentus.vein(5,6)]; % vein 5 radius value
vein6.p1 = [sf1 * asydentus.vein(6,1), sf2 * asydentus.vein(6,2)]; % vein 6 startpoint
vein6.p2 = [sf1 * asydentus.vein(6,4), sf2 * asydentus.vein(6,5)]; % vein 6 endpoint
vein6.r = sf3 * [asydentus.vein(6,6)]; % vein 6 radius value
vein7.p1 = [sf1 * asydentus.vein(7,1), sf2 * asydentus.vein(7,2)]; % vein 7 startpoint
vein7.p2 = [sf1 * asydentus.vein(7,4), sf2 * asydentus.vein(7,5)]; % vein 7 endpoint
vein7.r = sf3 * [asydentus.vein(7,6)]; % vein 7 radius value
crossvein1.x1 = sf1 * [asydentus.cross_vein(1,1)]; % crossvein 1 start x-coordinate
crossvein1.x2 = sf1 * [asydentus.cross_vein(1,2)]; % crossvein 1 end x-coordinate
crossvein4.x1 = sf1 * [asydentus.cross_vein(4,1)]; % crossvein 4 start x-coordinate
crossvein4.x2 = sf1 * [asydentus.cross_vein(4,2)]; % crossvein 4 end x-coordinate
crossvein5.x1 = sf1 * [asydentus.cross_vein(5,1)]; % crossvein 5 start x-coordinate
crossvein5.x2 = sf1 * [asydentus.cross_vein(5,2)]; % crossvein 5 end x-coordinate
crossvein6.x1 = sf1 * [asydentus.cross_vein(6,1)]; % crossvein 6 start x-coordinate
crossvein6.x2 = sf1 * [asydentus.cross_vein(6,1)]; % crossvein 6 end x-coordinate
%% Solve for centre of radius and cross-vein coordinates
syms x1 y1
[x1, y1] = solve((x1-vein1.p1(1))^2+(y1-vein1.p1(2))^2==vein1.r^2, (x1-vein1.p2(1))^2+(y1-vein1.p2(2))^2==vein1.r^2, x1, y1);
% vein 1 centre of radius
arc1_c1 = double([x1(1), y1(1)]);
arc1_c2 = double([x1(2), y1(2)]);
syms x2 y2
[x2, y2] = solve((x2-vein2.p1(1))^2+(y2-vein2.p1(2))^2==vein2.r^2, (x2-vein2.p2(1))^2+(y2-vein2.p2(2))^2==vein2.r^2, x2, y2);
% vein 2 centre of radius
arc2_c1 = double([x2(1), y2(1)]);
arc2_c2 = double([x2(2), y2(2)]);
syms x3 y3
[x3, y3] = solve((x3-vein3.p1(1))^2+(y3-vein3.p1(2))^2==vein3.r^2, (x3-vein3.p2(1))^2+(y3-vein3.p2(2))^2==vein3.r^2, x3, y3);
% vein 3 centre of radius
arc3_c1 = double([x3(1), y3(1)]);
arc3_c2 = double([x3(2), y3(2)]);
syms x4 y4
[x4, y4] = solve((x4-vein4.p1(1))^2+(y4-vein4.p1(2))^2==vein4.r^2, (x4-vein4.p2(1))^2+(y4-vein4.p2(2))^2==vein4.r^2, x4, y4);
% vein 4 centre of radius
arc4_c1 = double([x4(1), y4(1)]);
arc4_c2 = double([x4(2), y4(2)]);
syms x5 y5
[x5, y5] = solve((x5-vein5.p1(1))^2+(y5-vein5.p1(2))^2==vein5.r^2, (x5-vein5.p2(1))^2+(y5-vein5.p2(2))^2==vein5.r^2, x5, y5);
% vein 5 centre of radius
arc5_c1 = double([x5(1), y5(1)]);
arc5_c2 = double([x5(2), y5(2)]);
syms x6 y6
[x6, y6] = solve((x6-vein6.p1(1))^2+(y6-vein6.p1(2))^2==vein6.r^2, (x6-vein6.p2(1))^2+(y6-vein6.p2(2))^2==vein6.r^2, x6, y6);
% vein 6 centre of radius
arc6_c1 = double([x6(1), y6(1)]);
arc6_c2 = double([x6(2), y6(2)]);
syms x7 y7
[x7, y7] = solve((x7-vein7.p1(1))^2+(y7-vein7.p1(2))^2==vein7.r^2, (x7-vein7.p2(1))^2+(y7-vein7.p2(2))^2==vein7.r^2, x7, y7);
% vein 7 centre of radius
arc7_c1 = double([x7(1), y7(1)]);
arc7_c2 = double([x7(2), y7(2)]);
syms yc1_1
[yc1_1] = solve ((crossvein1.x1(1) – arc1_c1(1)).^2 + (yc1_1 – arc1_c1(2)).^2 – vein1.r^2, (-200<=yc1_1)<=0);
crossvein1.y1 = yc1_1;
syms yc1_2
[yc1_2] = solve ((crossvein1.x2(1) – arc2_c2(1)).^2 + (yc1_2 – arc2_c2(2)).^2 – vein2.r^2, (-200<=yc1_2)<=0);
crossvein1.y2 = yc1_2;
syms yc4_1
[yc4_1] = solve ((crossvein4.x1(1) – arc4_c2(1)).^2 + (yc4_1 – arc4_c2(2)).^2 – vein4.r^2, (-200<=yc4_1)<=0);
crossvein4.y1 = yc4_1;
syms yc4_2
[yc4_2] = solve ((crossvein4.x2(1) – arc5_c1(1)).^2 + (yc4_2 – arc5_c1(2)).^2 – vein5.r^2, (-200<=yc4_2)<=0);
crossvein4.y2 = yc4_2;
syms yc5_1
[yc5_1] = solve ((crossvein5.x1(1) – arc5_c1(1)).^2 + (yc5_1 – arc5_c1(2)).^2 – vein5.r^2, (-200<=yc5_1)<=0);
crossvein5.y1 = yc5_1;
syms yc5_2
[yc5_2] = solve ((crossvein5.x2(1) – arc6_c1(1)).^2 + (yc5_2 – arc6_c1(2)).^2 – vein6.r^2, (-200<=yc5_2)<=0);
crossvein5.y2 = yc5_2;
syms yc6_1
[yc6_1] = solve ((crossvein6.x1(1) – arc6_c1(1)).^2 + (yc6_1 – arc6_c1(2)).^2 – vein6.r^2, (-200<=yc6_1)<=0);
crossvein6.y1 = yc6_1;
syms yc6_2
[yc6_2] = solve ((crossvein6.x2(1) – arc7_c1(1)).^2 + (yc6_2 – arc7_c1(2)).^2 – vein7.r^2, (-200<=yc6_2)<=0);
crossvein6.y2 = yc6_2;
%% Define Arc Function for vein radius
figure;
hold on;
% Define the implicit functions for the circles
f1_1 = @(X1, Y1) (X1 – arc1_c1(1)).^2 + (Y1 – arc1_c1(2)).^2 – vein1.r^2;
f1_2 = @(X1, Y1) (X1 – arc1_c2(1)).^2 + (Y1 – arc1_c2(2)).^2 – vein1.r^2;
f2_1 = @(X2, Y2) (X2 – arc2_c1(1)).^2 + (Y2 – arc2_c1(2)).^2 – vein2.r^2;
f2_2 = @(X2, Y2) (X2 – arc2_c2(1)).^2 + (Y2 – arc2_c2(2)).^2 – vein2.r^2;
f3_1 = @(X3, Y3) (X3 – arc3_c1(1)).^2 + (Y3 – arc3_c1(2)).^2 – vein3.r^2;
f3_2 = @(X3, Y3) (X3 – arc3_c2(1)).^2 + (Y3 – arc3_c2(2)).^2 – vein3.r^2;
f4_1 = @(X4, Y4) (X4 – arc4_c1(1)).^2 + (Y4 – arc4_c1(2)).^2 – vein4.r^2;
f4_2 = @(X4, Y4) (X4 – arc4_c2(1)).^2 + (Y4 – arc4_c2(2)).^2 – vein4.r^2;
f5_1 = @(X5, Y5) (X5 – arc5_c1(1)).^2 + (Y5 – arc5_c1(2)).^2 – vein5.r^2;
f5_2 = @(X5, Y5) (X5 – arc5_c2(1)).^2 + (Y5 – arc5_c2(2)).^2 – vein5.r^2;
f6_1 = @(X6, Y6) (X6 – arc6_c1(1)).^2 + (Y6 – arc6_c1(2)).^2 – vein6.r^2;
f6_2 = @(X6, Y6) (X6 – arc6_c2(1)).^2 + (Y6 – arc6_c2(2)).^2 – vein6.r^2;
f7_1 = @(X7, Y7) (X7 – arc7_c1(1)).^2 + (Y7 – arc7_c1(2)).^2 – vein7.r^2;
f7_2 = @(X7, Y7) (X7 – arc7_c2(1)).^2 + (Y7 – arc7_c2(2)).^2 – vein7.r^2;
%% Plot the veins and cross-veins using fimplicit
% Depending on whether the arc of the vein is 0<=180 or 180<=360 will
% decide which implicit function is used
% use image representations as a guide
t = [1; 2; 3]; % Line Thickness
fimplicit(f1_1, [5 370 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f1_2, [5 370 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed
%fimplicit(f2_1, [9 175 -200 0], ‘LineWidth’, t(3) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
fimplicit(f2_2, [9 175 -200 0], ‘LineWidth’, t(3) , ‘Color’, ‘k’); % Adjust LineWidth as needed
%fimplicit(f3_1, [55 285 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
fimplicit(f3_2, [55 285 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed
%fimplicit(f4_1, [55 347 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
fimplicit(f4_2, [55 347 -200 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed
fimplicit(f5_1, [40 298 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f5_2, [40 298 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed
fimplicit(f6_1, [40 252 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f6_2, [40 252 -200 0], ‘LineWidth’, t(2) , ‘Color’, ‘k’); % Adjust LineWidth as needed
fimplicit(f7_1, [40 100 -160 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed, matrix within fimplicit is made
%fimplicit(f7_2, [40 100 -160 0], ‘LineWidth’, t(1) , ‘Color’, ‘k’); % Adjust LineWidth as needed
plot([crossvein1.x1 crossvein1.x2], [crossvein1.y1 crossvein1.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
plot([crossvein4.x1 crossvein4.x2], [crossvein4.y1 crossvein4.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
plot([crossvein5.x1 crossvein5.x2], [crossvein5.y1 crossvein5.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
plot([crossvein6.x1 crossvein6.x2], [crossvein6.y1 crossvein6.y2], ‘LineWidth’,t(2), ‘Color’, ‘r’)
% Plot settings
axis([0 400 -200 0]);
xlabel(‘X’);
ylabel(‘Y’);
title(‘Asydentus Venation’);
hold off; image analysis, digital image processing MATLAB Answers — New Questions
How do features from ‘license’ correspond to names from ‘ver’
This is the best information I had available as of May 2019.
Many of the codes used by ver() are missing as I do not have all products available for installation. Historical information is not always present.
The first column is the formal name of the product such as it shows up in ver(). It is not uncommon for Mathworks to rebrand a product.
The second column is the name of the product as it appears in license files. It would be those names that you would use with the license() command, such as |license(‘test’, ‘Audio_System_Toolbox’) . It is rare for Mathworks to change a license code — only when the license model itself changes such as Polyspace as of R2019a. When toolboxes get merged, one of the license codes is retained. The license code is the best way to follow products through historical releases.
The third column is the name of the product used by ver(). For example, ver(‘audio’). It is often the same as the name of the major sub-directory that the product is installed into. The ver code typically stays the same as products are rebranded, even if the installation directory moves. The installation directory mostly stays the same as products get rebranded, but tends to move as products get merge, and sometimes eventually changes after a rebrand. Historically, the code used by ver has typically matched the URL used in the documentation of the product, such as the Global Optimization Toolbox documentation being underneath /help/gads where gads is the ver code (the original product name was Genetic Algorithm and Direct Search Toolbox, GADS)
licver_info = {
‘5G Toolbox’ ‘MATLAB_5G_Toolbox’ ‘<unknown>’ %needs ver code
‘Aerospace Blockset’ ‘Aerospace_Blockset’ ‘aeroblks’
‘Aerospace Toolbox’ ‘Aerospace_Toolbox’ ‘aero’
‘Antenna Toolbox’ ‘Antenna_Toolbox’ ‘antenna’
‘Audio System Toolbox’ ‘Audio_System_Toolbox’ ‘audio’
‘Automated Driving Toolbox’ ‘Automated_Driving_Toolbox’ ‘<unknown>’ %needs ver code
‘AUTOSAR Blockset’ ‘AUTOSAR_Blockset’ ‘<unknown>’ %needs ver code
‘Bioinformatics Toolbox’ ‘Bioinformatics_Toolbox’ ‘bioinfo’
‘Communications System Toolbox’ ‘Communication_Toolbox’ ‘comm’
‘Computer Vision System Toolbox’ ‘Video_and_Image_Blockset’ ‘vision’
‘Control System Toolbox’ ‘Control_Toolbox’ ‘control’
‘Curve Fitting Toolbox’ ‘Curve_Fitting_Toolbox’ ‘curvefit’
‘DSP System Toolbox’ ‘Signal_Blocks’ ‘dsp’
‘Data Acquisition Toolbox’ ‘Data_Acq_Toolbox’ ‘daq’
‘Database Toolbox’ ‘Database_Toolbox’ ‘database’
‘Datafeed Toolbox’ ‘Datafeed_Toolbox’ ‘datafeed’
‘Deep Learning Toolbox’ ‘Neural_Network_Toolbox’ ‘nnet’
‘DO Qualification Kit’ ‘Qual_Kit_DO’ ‘<unknown>’ %needs ver code
‘Econometrics Toolbox’ ‘Econometrics_Toolbox’ ‘econ’
‘Embedded Coder’ ‘RTW_Embedded_Coder’ ’embeddedcoder’
‘Filter Design HDL Coder’ ‘Filter_Design_HDL_Coder’ ‘<unknown>’ %needs ver code
‘Financial Instruments Toolbox’ ‘Fin_Instruments_Toolbox’ ‘fininst’
‘Financial Toolbox’ ‘Financial_Toolbox’ ‘finance’
‘Fixed-Point Designer’ ‘Fixed_Point_Toolbox’ ‘fixedpoint’
‘Fuzzy Logic Toolbox’ ‘Fuzzy_Toolbox’ ‘fuzzy’
‘Global Optimization Toolbox’ ‘GADS_Toolbox’ ‘globaloptim’
‘GPU Coder’ ‘GPU_Coder’ ‘<unknown>’ %needs ver code
‘HDL Coder’ ‘Simulink_HDL_Coder’ ‘<unknown>’ %needs ver code
‘HDL Verifier’ ‘EDA_Simulator_Link’ ‘<unknown>’ %needs ver code
‘Image Acquisition Toolbox’ ‘Image_Acquisition_Toolbox’ ‘imaq’
‘Image Processing Toolbox’ ‘Image_Toolbox’ ‘images’
‘Instrument Control Toolbox’ ‘Instr_Control_Toolbox’ ‘instrument’
‘LTE Toolbox’ ‘LTE_Toolbox’ ‘<unknown>’ %needs ver code
‘LTE HDL Toolbox’ ‘LTE HDL Toolbox’ ‘<unknown>’ %needs ver code
‘MATLAB’ ‘MATLAB’ ‘general’
‘MATLAB Coder’ ‘MATLAB_Coder’ ‘matlabcoder’
‘MATLAB Compiler’ ‘Compiler’ ‘compiler’
‘MATLAB Compiler SDK’ ‘MATLAB_Builder_for_Java’ ‘<unknown>’ %needs ver code
‘MATLAB Parallel Server’ ‘MATLAB_Distrib_Comp_Engine’ ‘<unknown>’ %needs ver code
‘MATLAB Production Server’ ‘MATLAB_Production_Server’ ‘<unknown>’ %needs ver code
‘MATLAB Report Generator’ ‘MATLAB_Report_Gen’ ‘rptgen’
‘Mapping Toolbox’ ‘MAP_Toolbox’ ‘map’
‘Mixed-Signal Blockset’ ‘Mixed_Signal_Blockset’ ‘<unknown>’ %needs ver code
‘Model-Based Calibration Toolbox’ ‘MBC_Toolbox’ ‘<unknown>’ %needs ver code
‘Model Predictive Control Toolbox’ ‘MPC_Toolbox’ ‘mpc’
‘Neural Network Toolbox’ ‘Neural_Network_Toolbox’ ‘nnet’ %renamed to Deep Learning
‘OPC Toolbox’ ‘OPC_Toolbox’ ‘<unknown>’ %needs ver code
‘Optimization Toolbox’ ‘Optimization_Toolbox’ ‘optim’
‘Parallel Computing Toolbox’ ‘Distrib_Computing_Toolbox’ ‘distcomp’ %e.g., local parfor, gpu — not the server. newer releases ver(‘parallel’)
‘Partial Differential Equation Toolbox’ ‘PDE_Toolbox’ ‘pde’
‘Phased Array System Toolbox’ ‘Phased_Array_System_Toolbox’ ‘phased’
‘Polyspace Bug Finder’ ‘Polyspace_BF’ ‘<unknown>’ %newer flex name %needs ver code
‘Polyspace Bug Finder’ ‘PolySpace_Bug_Finder’ ‘psbugfinder’ %older flex name
‘Polyspace Bug Finder’ ‘PolySpace_Bug_Finder_Engine’ ‘psbugfinder’ %older flex name
‘Polyspace Bug Finder Server’ ‘Polyspace_BF_Server’ ‘<unknown>’ %newer flex name %needs ver code
‘Polyspace Code Prover’ ‘PolySpace_Server_C_CPP’ ‘pscodeprover’ %older flex name
‘Polyspace Code Prover’ ‘Polyspace_CP’ ‘<unknown>’ %newer flex name %needs ver code
‘Polyspace Code Prover Server’ ‘Polyspace_CP_Server’ ‘<unknown>’ %newer flex name %needs ver code
‘Powertrain Blockset’ ‘Powertrain_Blockset’ ‘<unknown>’ %needs ver code
‘Predictive Maintenance Toolbox’ ‘Pred_Maintenance_Toolbox’ ‘<unknown>’ %needs ver code
‘Reinforcement Learning Toolbox’ ‘Reinforcement_Learn_Toolbox’ ‘<unknown>’ %needs ver code
‘RF Blockset’ ‘RF_Blockset’ ‘rfblks’
‘RF Toolbox’ ‘RF_Toolbox’ ‘rf’
‘Risk Management Toolbox’ ‘Risk_Management_Toolbox’ ‘<unknown>’ %needs ver code
‘Robotics System Toolbox’ ‘Robotics_System_Toolbox’ ‘robotics’
‘Robust Control Toolbox’ ‘Robust_Toolbox’ ‘robust’
‘Sensor Fusion and Tracking Toolbox’ ‘Sensor_Fusion_and_Tracking’ ‘<unknown>’ %needs ver code
‘SerDes Toolbox’ ‘SerDes_Toolbox’ ‘<unknown>’ %needs ver code
‘Signal Processing Toolbox’ ‘Signal_Toolbox’ ‘signal’
‘SimBiology’ ‘Simbiology’ ‘simbio’
‘SimEvents’ ‘SimEvents’ ‘simevents’
‘Simscape’ ‘Simscape’ ‘simscape’
‘Simscape Driveline’ ‘SimDriveline’ ‘sdl’ %possibly ‘simdrive’
‘Simscape Electronics’ ‘SimElectronics’ ‘elec’
‘Simscape Fluids’ ‘SimHydraulics’ ‘fluids’
‘Simscape Multibody’ ‘SimMechanics’ ‘mech’
‘Simscape Power Systems’ ‘Power_System_Blocks’ ‘sps’
‘Simulink’ ‘SIMULINK’ ‘simulink’
‘Simulink 3D Animation’ ‘Virtual_Reality_Toolbox’ ‘sl3d’
‘Simulink Check’ ‘SL_Verification_Validation’ ‘<unknown>’ %needs ver code
‘Simulink Code Inspector’ ‘Simulink_Code_Inspector’ ‘<unknown>’ %needs ver code
‘Simulink Coder’ ‘Real-Time_Workshop’ ‘simulinkcoder’
‘Simulink Control Design’ ‘Simulink_Control_Design’ ‘slcontrol’
‘Simulink Coverage’ ‘Simulink_Coverage’ ‘<unknown>’ %needs ver code
‘Simulink Design Optimization’ ‘Simulink_Design_Optim’ ‘sldo’
‘Simulink Desktop Real-Time’ ‘Real-Time_Win_Target’ ‘sldrt’
‘Simulink Design Verifier’ ‘Simulink_Design_Verifier’ ‘<unknown>’ %needs ver code
‘Simulink PLC Coder’ ‘Simulink_PLC_Coder’
‘Simulink Real-Time’ ‘XPC_Target’ ‘<unknown>’ %needs ver code
‘Simulink Report Generator’ ‘SIMULINK_Report_Gen’ ‘rptgenext’
‘Simulink Requirements’ ‘Simulink_Requirements’ ‘<unknown>’ %needs ver code
‘Simulink Test’ ‘Simulink_Test’ ‘<unknown>’ %needs ver code
‘SoC Blockset’ ‘SoC_Blockset’ ‘<unknown>’ %needs ver code
‘Spreadsheet Link’ ‘Excel_Link’ ‘excellink’
‘Stateflow’ ‘Stateflow’ ‘stateflow’
‘Statistics and Machine Learning Toolbox’ ‘Statistics_Toolbox’ ‘stats’
‘Symbolic Math Toolbox’ ‘Symbolic_Toolbox’ ‘symbolic’
‘System Identification Toolbox’ ‘Identification_Toolbox’ ‘ident’
‘System Composer’ ‘System_Composer’ ‘<unknown>’ %needs ver code
‘Text Analytics Toolbox’ ‘Text_Analytics_Toolbox’ ‘<unknown>’ %needs ver code
‘Trading Toolbox’ ‘Trading_Toolbox’ ‘trading’
‘Vehicle Dynamics Blockset’ ‘Vehicle_Dynamics_Blockset’ ‘<unknown>’ %needs ver code
‘Vehicle Network Toolbox’ ‘Vehicle_Network_Toolbox’ ‘<unknown>’ %needs ver code
‘Vision HDL Toolbox’ ‘Vision_HDL_Toolbox’ ‘<unknown>’ %needs ver code
‘Wavelet Toolbox’ ‘Wavelet_Toolbox’ ‘wavelet’
‘WLAN Toolbox’ ‘WLAN_System_Toolbox’ ‘<unknown>’ %needs ver code
};
A useful post for this purpose was https://www.mathworks.com/matlabcentral/answers/195425-how-do-i-get-a-license-feature-name-for-a-toolbox-in-verThis is the best information I had available as of May 2019.
Many of the codes used by ver() are missing as I do not have all products available for installation. Historical information is not always present.
The first column is the formal name of the product such as it shows up in ver(). It is not uncommon for Mathworks to rebrand a product.
The second column is the name of the product as it appears in license files. It would be those names that you would use with the license() command, such as |license(‘test’, ‘Audio_System_Toolbox’) . It is rare for Mathworks to change a license code — only when the license model itself changes such as Polyspace as of R2019a. When toolboxes get merged, one of the license codes is retained. The license code is the best way to follow products through historical releases.
The third column is the name of the product used by ver(). For example, ver(‘audio’). It is often the same as the name of the major sub-directory that the product is installed into. The ver code typically stays the same as products are rebranded, even if the installation directory moves. The installation directory mostly stays the same as products get rebranded, but tends to move as products get merge, and sometimes eventually changes after a rebrand. Historically, the code used by ver has typically matched the URL used in the documentation of the product, such as the Global Optimization Toolbox documentation being underneath /help/gads where gads is the ver code (the original product name was Genetic Algorithm and Direct Search Toolbox, GADS)
licver_info = {
‘5G Toolbox’ ‘MATLAB_5G_Toolbox’ ‘<unknown>’ %needs ver code
‘Aerospace Blockset’ ‘Aerospace_Blockset’ ‘aeroblks’
‘Aerospace Toolbox’ ‘Aerospace_Toolbox’ ‘aero’
‘Antenna Toolbox’ ‘Antenna_Toolbox’ ‘antenna’
‘Audio System Toolbox’ ‘Audio_System_Toolbox’ ‘audio’
‘Automated Driving Toolbox’ ‘Automated_Driving_Toolbox’ ‘<unknown>’ %needs ver code
‘AUTOSAR Blockset’ ‘AUTOSAR_Blockset’ ‘<unknown>’ %needs ver code
‘Bioinformatics Toolbox’ ‘Bioinformatics_Toolbox’ ‘bioinfo’
‘Communications System Toolbox’ ‘Communication_Toolbox’ ‘comm’
‘Computer Vision System Toolbox’ ‘Video_and_Image_Blockset’ ‘vision’
‘Control System Toolbox’ ‘Control_Toolbox’ ‘control’
‘Curve Fitting Toolbox’ ‘Curve_Fitting_Toolbox’ ‘curvefit’
‘DSP System Toolbox’ ‘Signal_Blocks’ ‘dsp’
‘Data Acquisition Toolbox’ ‘Data_Acq_Toolbox’ ‘daq’
‘Database Toolbox’ ‘Database_Toolbox’ ‘database’
‘Datafeed Toolbox’ ‘Datafeed_Toolbox’ ‘datafeed’
‘Deep Learning Toolbox’ ‘Neural_Network_Toolbox’ ‘nnet’
‘DO Qualification Kit’ ‘Qual_Kit_DO’ ‘<unknown>’ %needs ver code
‘Econometrics Toolbox’ ‘Econometrics_Toolbox’ ‘econ’
‘Embedded Coder’ ‘RTW_Embedded_Coder’ ’embeddedcoder’
‘Filter Design HDL Coder’ ‘Filter_Design_HDL_Coder’ ‘<unknown>’ %needs ver code
‘Financial Instruments Toolbox’ ‘Fin_Instruments_Toolbox’ ‘fininst’
‘Financial Toolbox’ ‘Financial_Toolbox’ ‘finance’
‘Fixed-Point Designer’ ‘Fixed_Point_Toolbox’ ‘fixedpoint’
‘Fuzzy Logic Toolbox’ ‘Fuzzy_Toolbox’ ‘fuzzy’
‘Global Optimization Toolbox’ ‘GADS_Toolbox’ ‘globaloptim’
‘GPU Coder’ ‘GPU_Coder’ ‘<unknown>’ %needs ver code
‘HDL Coder’ ‘Simulink_HDL_Coder’ ‘<unknown>’ %needs ver code
‘HDL Verifier’ ‘EDA_Simulator_Link’ ‘<unknown>’ %needs ver code
‘Image Acquisition Toolbox’ ‘Image_Acquisition_Toolbox’ ‘imaq’
‘Image Processing Toolbox’ ‘Image_Toolbox’ ‘images’
‘Instrument Control Toolbox’ ‘Instr_Control_Toolbox’ ‘instrument’
‘LTE Toolbox’ ‘LTE_Toolbox’ ‘<unknown>’ %needs ver code
‘LTE HDL Toolbox’ ‘LTE HDL Toolbox’ ‘<unknown>’ %needs ver code
‘MATLAB’ ‘MATLAB’ ‘general’
‘MATLAB Coder’ ‘MATLAB_Coder’ ‘matlabcoder’
‘MATLAB Compiler’ ‘Compiler’ ‘compiler’
‘MATLAB Compiler SDK’ ‘MATLAB_Builder_for_Java’ ‘<unknown>’ %needs ver code
‘MATLAB Parallel Server’ ‘MATLAB_Distrib_Comp_Engine’ ‘<unknown>’ %needs ver code
‘MATLAB Production Server’ ‘MATLAB_Production_Server’ ‘<unknown>’ %needs ver code
‘MATLAB Report Generator’ ‘MATLAB_Report_Gen’ ‘rptgen’
‘Mapping Toolbox’ ‘MAP_Toolbox’ ‘map’
‘Mixed-Signal Blockset’ ‘Mixed_Signal_Blockset’ ‘<unknown>’ %needs ver code
‘Model-Based Calibration Toolbox’ ‘MBC_Toolbox’ ‘<unknown>’ %needs ver code
‘Model Predictive Control Toolbox’ ‘MPC_Toolbox’ ‘mpc’
‘Neural Network Toolbox’ ‘Neural_Network_Toolbox’ ‘nnet’ %renamed to Deep Learning
‘OPC Toolbox’ ‘OPC_Toolbox’ ‘<unknown>’ %needs ver code
‘Optimization Toolbox’ ‘Optimization_Toolbox’ ‘optim’
‘Parallel Computing Toolbox’ ‘Distrib_Computing_Toolbox’ ‘distcomp’ %e.g., local parfor, gpu — not the server. newer releases ver(‘parallel’)
‘Partial Differential Equation Toolbox’ ‘PDE_Toolbox’ ‘pde’
‘Phased Array System Toolbox’ ‘Phased_Array_System_Toolbox’ ‘phased’
‘Polyspace Bug Finder’ ‘Polyspace_BF’ ‘<unknown>’ %newer flex name %needs ver code
‘Polyspace Bug Finder’ ‘PolySpace_Bug_Finder’ ‘psbugfinder’ %older flex name
‘Polyspace Bug Finder’ ‘PolySpace_Bug_Finder_Engine’ ‘psbugfinder’ %older flex name
‘Polyspace Bug Finder Server’ ‘Polyspace_BF_Server’ ‘<unknown>’ %newer flex name %needs ver code
‘Polyspace Code Prover’ ‘PolySpace_Server_C_CPP’ ‘pscodeprover’ %older flex name
‘Polyspace Code Prover’ ‘Polyspace_CP’ ‘<unknown>’ %newer flex name %needs ver code
‘Polyspace Code Prover Server’ ‘Polyspace_CP_Server’ ‘<unknown>’ %newer flex name %needs ver code
‘Powertrain Blockset’ ‘Powertrain_Blockset’ ‘<unknown>’ %needs ver code
‘Predictive Maintenance Toolbox’ ‘Pred_Maintenance_Toolbox’ ‘<unknown>’ %needs ver code
‘Reinforcement Learning Toolbox’ ‘Reinforcement_Learn_Toolbox’ ‘<unknown>’ %needs ver code
‘RF Blockset’ ‘RF_Blockset’ ‘rfblks’
‘RF Toolbox’ ‘RF_Toolbox’ ‘rf’
‘Risk Management Toolbox’ ‘Risk_Management_Toolbox’ ‘<unknown>’ %needs ver code
‘Robotics System Toolbox’ ‘Robotics_System_Toolbox’ ‘robotics’
‘Robust Control Toolbox’ ‘Robust_Toolbox’ ‘robust’
‘Sensor Fusion and Tracking Toolbox’ ‘Sensor_Fusion_and_Tracking’ ‘<unknown>’ %needs ver code
‘SerDes Toolbox’ ‘SerDes_Toolbox’ ‘<unknown>’ %needs ver code
‘Signal Processing Toolbox’ ‘Signal_Toolbox’ ‘signal’
‘SimBiology’ ‘Simbiology’ ‘simbio’
‘SimEvents’ ‘SimEvents’ ‘simevents’
‘Simscape’ ‘Simscape’ ‘simscape’
‘Simscape Driveline’ ‘SimDriveline’ ‘sdl’ %possibly ‘simdrive’
‘Simscape Electronics’ ‘SimElectronics’ ‘elec’
‘Simscape Fluids’ ‘SimHydraulics’ ‘fluids’
‘Simscape Multibody’ ‘SimMechanics’ ‘mech’
‘Simscape Power Systems’ ‘Power_System_Blocks’ ‘sps’
‘Simulink’ ‘SIMULINK’ ‘simulink’
‘Simulink 3D Animation’ ‘Virtual_Reality_Toolbox’ ‘sl3d’
‘Simulink Check’ ‘SL_Verification_Validation’ ‘<unknown>’ %needs ver code
‘Simulink Code Inspector’ ‘Simulink_Code_Inspector’ ‘<unknown>’ %needs ver code
‘Simulink Coder’ ‘Real-Time_Workshop’ ‘simulinkcoder’
‘Simulink Control Design’ ‘Simulink_Control_Design’ ‘slcontrol’
‘Simulink Coverage’ ‘Simulink_Coverage’ ‘<unknown>’ %needs ver code
‘Simulink Design Optimization’ ‘Simulink_Design_Optim’ ‘sldo’
‘Simulink Desktop Real-Time’ ‘Real-Time_Win_Target’ ‘sldrt’
‘Simulink Design Verifier’ ‘Simulink_Design_Verifier’ ‘<unknown>’ %needs ver code
‘Simulink PLC Coder’ ‘Simulink_PLC_Coder’
‘Simulink Real-Time’ ‘XPC_Target’ ‘<unknown>’ %needs ver code
‘Simulink Report Generator’ ‘SIMULINK_Report_Gen’ ‘rptgenext’
‘Simulink Requirements’ ‘Simulink_Requirements’ ‘<unknown>’ %needs ver code
‘Simulink Test’ ‘Simulink_Test’ ‘<unknown>’ %needs ver code
‘SoC Blockset’ ‘SoC_Blockset’ ‘<unknown>’ %needs ver code
‘Spreadsheet Link’ ‘Excel_Link’ ‘excellink’
‘Stateflow’ ‘Stateflow’ ‘stateflow’
‘Statistics and Machine Learning Toolbox’ ‘Statistics_Toolbox’ ‘stats’
‘Symbolic Math Toolbox’ ‘Symbolic_Toolbox’ ‘symbolic’
‘System Identification Toolbox’ ‘Identification_Toolbox’ ‘ident’
‘System Composer’ ‘System_Composer’ ‘<unknown>’ %needs ver code
‘Text Analytics Toolbox’ ‘Text_Analytics_Toolbox’ ‘<unknown>’ %needs ver code
‘Trading Toolbox’ ‘Trading_Toolbox’ ‘trading’
‘Vehicle Dynamics Blockset’ ‘Vehicle_Dynamics_Blockset’ ‘<unknown>’ %needs ver code
‘Vehicle Network Toolbox’ ‘Vehicle_Network_Toolbox’ ‘<unknown>’ %needs ver code
‘Vision HDL Toolbox’ ‘Vision_HDL_Toolbox’ ‘<unknown>’ %needs ver code
‘Wavelet Toolbox’ ‘Wavelet_Toolbox’ ‘wavelet’
‘WLAN Toolbox’ ‘WLAN_System_Toolbox’ ‘<unknown>’ %needs ver code
};
A useful post for this purpose was https://www.mathworks.com/matlabcentral/answers/195425-how-do-i-get-a-license-feature-name-for-a-toolbox-in-ver This is the best information I had available as of May 2019.
Many of the codes used by ver() are missing as I do not have all products available for installation. Historical information is not always present.
The first column is the formal name of the product such as it shows up in ver(). It is not uncommon for Mathworks to rebrand a product.
The second column is the name of the product as it appears in license files. It would be those names that you would use with the license() command, such as |license(‘test’, ‘Audio_System_Toolbox’) . It is rare for Mathworks to change a license code — only when the license model itself changes such as Polyspace as of R2019a. When toolboxes get merged, one of the license codes is retained. The license code is the best way to follow products through historical releases.
The third column is the name of the product used by ver(). For example, ver(‘audio’). It is often the same as the name of the major sub-directory that the product is installed into. The ver code typically stays the same as products are rebranded, even if the installation directory moves. The installation directory mostly stays the same as products get rebranded, but tends to move as products get merge, and sometimes eventually changes after a rebrand. Historically, the code used by ver has typically matched the URL used in the documentation of the product, such as the Global Optimization Toolbox documentation being underneath /help/gads where gads is the ver code (the original product name was Genetic Algorithm and Direct Search Toolbox, GADS)
licver_info = {
‘5G Toolbox’ ‘MATLAB_5G_Toolbox’ ‘<unknown>’ %needs ver code
‘Aerospace Blockset’ ‘Aerospace_Blockset’ ‘aeroblks’
‘Aerospace Toolbox’ ‘Aerospace_Toolbox’ ‘aero’
‘Antenna Toolbox’ ‘Antenna_Toolbox’ ‘antenna’
‘Audio System Toolbox’ ‘Audio_System_Toolbox’ ‘audio’
‘Automated Driving Toolbox’ ‘Automated_Driving_Toolbox’ ‘<unknown>’ %needs ver code
‘AUTOSAR Blockset’ ‘AUTOSAR_Blockset’ ‘<unknown>’ %needs ver code
‘Bioinformatics Toolbox’ ‘Bioinformatics_Toolbox’ ‘bioinfo’
‘Communications System Toolbox’ ‘Communication_Toolbox’ ‘comm’
‘Computer Vision System Toolbox’ ‘Video_and_Image_Blockset’ ‘vision’
‘Control System Toolbox’ ‘Control_Toolbox’ ‘control’
‘Curve Fitting Toolbox’ ‘Curve_Fitting_Toolbox’ ‘curvefit’
‘DSP System Toolbox’ ‘Signal_Blocks’ ‘dsp’
‘Data Acquisition Toolbox’ ‘Data_Acq_Toolbox’ ‘daq’
‘Database Toolbox’ ‘Database_Toolbox’ ‘database’
‘Datafeed Toolbox’ ‘Datafeed_Toolbox’ ‘datafeed’
‘Deep Learning Toolbox’ ‘Neural_Network_Toolbox’ ‘nnet’
‘DO Qualification Kit’ ‘Qual_Kit_DO’ ‘<unknown>’ %needs ver code
‘Econometrics Toolbox’ ‘Econometrics_Toolbox’ ‘econ’
‘Embedded Coder’ ‘RTW_Embedded_Coder’ ’embeddedcoder’
‘Filter Design HDL Coder’ ‘Filter_Design_HDL_Coder’ ‘<unknown>’ %needs ver code
‘Financial Instruments Toolbox’ ‘Fin_Instruments_Toolbox’ ‘fininst’
‘Financial Toolbox’ ‘Financial_Toolbox’ ‘finance’
‘Fixed-Point Designer’ ‘Fixed_Point_Toolbox’ ‘fixedpoint’
‘Fuzzy Logic Toolbox’ ‘Fuzzy_Toolbox’ ‘fuzzy’
‘Global Optimization Toolbox’ ‘GADS_Toolbox’ ‘globaloptim’
‘GPU Coder’ ‘GPU_Coder’ ‘<unknown>’ %needs ver code
‘HDL Coder’ ‘Simulink_HDL_Coder’ ‘<unknown>’ %needs ver code
‘HDL Verifier’ ‘EDA_Simulator_Link’ ‘<unknown>’ %needs ver code
‘Image Acquisition Toolbox’ ‘Image_Acquisition_Toolbox’ ‘imaq’
‘Image Processing Toolbox’ ‘Image_Toolbox’ ‘images’
‘Instrument Control Toolbox’ ‘Instr_Control_Toolbox’ ‘instrument’
‘LTE Toolbox’ ‘LTE_Toolbox’ ‘<unknown>’ %needs ver code
‘LTE HDL Toolbox’ ‘LTE HDL Toolbox’ ‘<unknown>’ %needs ver code
‘MATLAB’ ‘MATLAB’ ‘general’
‘MATLAB Coder’ ‘MATLAB_Coder’ ‘matlabcoder’
‘MATLAB Compiler’ ‘Compiler’ ‘compiler’
‘MATLAB Compiler SDK’ ‘MATLAB_Builder_for_Java’ ‘<unknown>’ %needs ver code
‘MATLAB Parallel Server’ ‘MATLAB_Distrib_Comp_Engine’ ‘<unknown>’ %needs ver code
‘MATLAB Production Server’ ‘MATLAB_Production_Server’ ‘<unknown>’ %needs ver code
‘MATLAB Report Generator’ ‘MATLAB_Report_Gen’ ‘rptgen’
‘Mapping Toolbox’ ‘MAP_Toolbox’ ‘map’
‘Mixed-Signal Blockset’ ‘Mixed_Signal_Blockset’ ‘<unknown>’ %needs ver code
‘Model-Based Calibration Toolbox’ ‘MBC_Toolbox’ ‘<unknown>’ %needs ver code
‘Model Predictive Control Toolbox’ ‘MPC_Toolbox’ ‘mpc’
‘Neural Network Toolbox’ ‘Neural_Network_Toolbox’ ‘nnet’ %renamed to Deep Learning
‘OPC Toolbox’ ‘OPC_Toolbox’ ‘<unknown>’ %needs ver code
‘Optimization Toolbox’ ‘Optimization_Toolbox’ ‘optim’
‘Parallel Computing Toolbox’ ‘Distrib_Computing_Toolbox’ ‘distcomp’ %e.g., local parfor, gpu — not the server. newer releases ver(‘parallel’)
‘Partial Differential Equation Toolbox’ ‘PDE_Toolbox’ ‘pde’
‘Phased Array System Toolbox’ ‘Phased_Array_System_Toolbox’ ‘phased’
‘Polyspace Bug Finder’ ‘Polyspace_BF’ ‘<unknown>’ %newer flex name %needs ver code
‘Polyspace Bug Finder’ ‘PolySpace_Bug_Finder’ ‘psbugfinder’ %older flex name
‘Polyspace Bug Finder’ ‘PolySpace_Bug_Finder_Engine’ ‘psbugfinder’ %older flex name
‘Polyspace Bug Finder Server’ ‘Polyspace_BF_Server’ ‘<unknown>’ %newer flex name %needs ver code
‘Polyspace Code Prover’ ‘PolySpace_Server_C_CPP’ ‘pscodeprover’ %older flex name
‘Polyspace Code Prover’ ‘Polyspace_CP’ ‘<unknown>’ %newer flex name %needs ver code
‘Polyspace Code Prover Server’ ‘Polyspace_CP_Server’ ‘<unknown>’ %newer flex name %needs ver code
‘Powertrain Blockset’ ‘Powertrain_Blockset’ ‘<unknown>’ %needs ver code
‘Predictive Maintenance Toolbox’ ‘Pred_Maintenance_Toolbox’ ‘<unknown>’ %needs ver code
‘Reinforcement Learning Toolbox’ ‘Reinforcement_Learn_Toolbox’ ‘<unknown>’ %needs ver code
‘RF Blockset’ ‘RF_Blockset’ ‘rfblks’
‘RF Toolbox’ ‘RF_Toolbox’ ‘rf’
‘Risk Management Toolbox’ ‘Risk_Management_Toolbox’ ‘<unknown>’ %needs ver code
‘Robotics System Toolbox’ ‘Robotics_System_Toolbox’ ‘robotics’
‘Robust Control Toolbox’ ‘Robust_Toolbox’ ‘robust’
‘Sensor Fusion and Tracking Toolbox’ ‘Sensor_Fusion_and_Tracking’ ‘<unknown>’ %needs ver code
‘SerDes Toolbox’ ‘SerDes_Toolbox’ ‘<unknown>’ %needs ver code
‘Signal Processing Toolbox’ ‘Signal_Toolbox’ ‘signal’
‘SimBiology’ ‘Simbiology’ ‘simbio’
‘SimEvents’ ‘SimEvents’ ‘simevents’
‘Simscape’ ‘Simscape’ ‘simscape’
‘Simscape Driveline’ ‘SimDriveline’ ‘sdl’ %possibly ‘simdrive’
‘Simscape Electronics’ ‘SimElectronics’ ‘elec’
‘Simscape Fluids’ ‘SimHydraulics’ ‘fluids’
‘Simscape Multibody’ ‘SimMechanics’ ‘mech’
‘Simscape Power Systems’ ‘Power_System_Blocks’ ‘sps’
‘Simulink’ ‘SIMULINK’ ‘simulink’
‘Simulink 3D Animation’ ‘Virtual_Reality_Toolbox’ ‘sl3d’
‘Simulink Check’ ‘SL_Verification_Validation’ ‘<unknown>’ %needs ver code
‘Simulink Code Inspector’ ‘Simulink_Code_Inspector’ ‘<unknown>’ %needs ver code
‘Simulink Coder’ ‘Real-Time_Workshop’ ‘simulinkcoder’
‘Simulink Control Design’ ‘Simulink_Control_Design’ ‘slcontrol’
‘Simulink Coverage’ ‘Simulink_Coverage’ ‘<unknown>’ %needs ver code
‘Simulink Design Optimization’ ‘Simulink_Design_Optim’ ‘sldo’
‘Simulink Desktop Real-Time’ ‘Real-Time_Win_Target’ ‘sldrt’
‘Simulink Design Verifier’ ‘Simulink_Design_Verifier’ ‘<unknown>’ %needs ver code
‘Simulink PLC Coder’ ‘Simulink_PLC_Coder’
‘Simulink Real-Time’ ‘XPC_Target’ ‘<unknown>’ %needs ver code
‘Simulink Report Generator’ ‘SIMULINK_Report_Gen’ ‘rptgenext’
‘Simulink Requirements’ ‘Simulink_Requirements’ ‘<unknown>’ %needs ver code
‘Simulink Test’ ‘Simulink_Test’ ‘<unknown>’ %needs ver code
‘SoC Blockset’ ‘SoC_Blockset’ ‘<unknown>’ %needs ver code
‘Spreadsheet Link’ ‘Excel_Link’ ‘excellink’
‘Stateflow’ ‘Stateflow’ ‘stateflow’
‘Statistics and Machine Learning Toolbox’ ‘Statistics_Toolbox’ ‘stats’
‘Symbolic Math Toolbox’ ‘Symbolic_Toolbox’ ‘symbolic’
‘System Identification Toolbox’ ‘Identification_Toolbox’ ‘ident’
‘System Composer’ ‘System_Composer’ ‘<unknown>’ %needs ver code
‘Text Analytics Toolbox’ ‘Text_Analytics_Toolbox’ ‘<unknown>’ %needs ver code
‘Trading Toolbox’ ‘Trading_Toolbox’ ‘trading’
‘Vehicle Dynamics Blockset’ ‘Vehicle_Dynamics_Blockset’ ‘<unknown>’ %needs ver code
‘Vehicle Network Toolbox’ ‘Vehicle_Network_Toolbox’ ‘<unknown>’ %needs ver code
‘Vision HDL Toolbox’ ‘Vision_HDL_Toolbox’ ‘<unknown>’ %needs ver code
‘Wavelet Toolbox’ ‘Wavelet_Toolbox’ ‘wavelet’
‘WLAN Toolbox’ ‘WLAN_System_Toolbox’ ‘<unknown>’ %needs ver code
};
A useful post for this purpose was https://www.mathworks.com/matlabcentral/answers/195425-how-do-i-get-a-license-feature-name-for-a-toolbox-in-ver ver, license, product names MATLAB Answers — New Questions
Python Matlab integration error – Error using numpy_ops>init thinc.backends.numpy_ops
I want to call my python script from the Matlab. I received the error Error using numpy_ops>init thinc.backends.numpy_ops
Python Error: ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject.
The Python script is as follows
import spacy
def text_recognizer(model_path, text):
try:
# Load the trained model
nlp = spacy.load(model_path)
print("Model loaded successfully.")
# Process the given text
doc = nlp(text)
ent_labels = [(ent.text, ent.label_) for ent in doc.ents]
return ent_labels
The Matlab script is as follows
% Set up the Python environment
pe = pyenv;
py.importlib.import_module(‘final_output’);
% Add the directory containing the Python script to the Python path
path_add = fileparts(which(‘final_output.py’));
if count(py.sys.path, path_add) == 0
insert(py.sys.path, int64(0), path_add);
end
% Define model path and text to process
model_path = ‘D:trained_model\output\model-best’;
text = ‘Roses are red’;
% Call the Python function
pyOut = py.final_output.text_recognizer(model_path, text);
% Convert the output to a MATLAB cell array
entity_labels = cell(pyOut);
disp(entity_labels);
I found one solution to update numpy, what I did, but nothing changed.
How can I fix the issue?I want to call my python script from the Matlab. I received the error Error using numpy_ops>init thinc.backends.numpy_ops
Python Error: ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject.
The Python script is as follows
import spacy
def text_recognizer(model_path, text):
try:
# Load the trained model
nlp = spacy.load(model_path)
print("Model loaded successfully.")
# Process the given text
doc = nlp(text)
ent_labels = [(ent.text, ent.label_) for ent in doc.ents]
return ent_labels
The Matlab script is as follows
% Set up the Python environment
pe = pyenv;
py.importlib.import_module(‘final_output’);
% Add the directory containing the Python script to the Python path
path_add = fileparts(which(‘final_output.py’));
if count(py.sys.path, path_add) == 0
insert(py.sys.path, int64(0), path_add);
end
% Define model path and text to process
model_path = ‘D:trained_model\output\model-best’;
text = ‘Roses are red’;
% Call the Python function
pyOut = py.final_output.text_recognizer(model_path, text);
% Convert the output to a MATLAB cell array
entity_labels = cell(pyOut);
disp(entity_labels);
I found one solution to update numpy, what I did, but nothing changed.
How can I fix the issue? I want to call my python script from the Matlab. I received the error Error using numpy_ops>init thinc.backends.numpy_ops
Python Error: ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject.
The Python script is as follows
import spacy
def text_recognizer(model_path, text):
try:
# Load the trained model
nlp = spacy.load(model_path)
print("Model loaded successfully.")
# Process the given text
doc = nlp(text)
ent_labels = [(ent.text, ent.label_) for ent in doc.ents]
return ent_labels
The Matlab script is as follows
% Set up the Python environment
pe = pyenv;
py.importlib.import_module(‘final_output’);
% Add the directory containing the Python script to the Python path
path_add = fileparts(which(‘final_output.py’));
if count(py.sys.path, path_add) == 0
insert(py.sys.path, int64(0), path_add);
end
% Define model path and text to process
model_path = ‘D:trained_model\output\model-best’;
text = ‘Roses are red’;
% Call the Python function
pyOut = py.final_output.text_recognizer(model_path, text);
% Convert the output to a MATLAB cell array
entity_labels = cell(pyOut);
disp(entity_labels);
I found one solution to update numpy, what I did, but nothing changed.
How can I fix the issue? python, matlab MATLAB Answers — New Questions
how to skip lines that start with a certain character while reading a text file
I have a text file with two coloumns for a certain amount of rows. The coloumns are then divided from a text line that start with #, how can I load only the data by removing the # line?I have a text file with two coloumns for a certain amount of rows. The coloumns are then divided from a text line that start with #, how can I load only the data by removing the # line? I have a text file with two coloumns for a certain amount of rows. The coloumns are then divided from a text line that start with #, how can I load only the data by removing the # line? text, load, file MATLAB Answers — New Questions
How to add error bars to scatter plot?
I have x and y data points that I’m fitting a custom equation to using cftool. I have also calculated vertical error for each of my points. How can I show the error bars and the fit at the same time?I have x and y data points that I’m fitting a custom equation to using cftool. I have also calculated vertical error for each of my points. How can I show the error bars and the fit at the same time? I have x and y data points that I’m fitting a custom equation to using cftool. I have also calculated vertical error for each of my points. How can I show the error bars and the fit at the same time? cftool MATLAB Answers — New Questions
Split step Fourier and shannon sampling theorem issue
Hi,
I am building a code to model a laser with multiple step optical pulse amplifiers, however when I increase the gain I tend to get spectral aliasing. Little explanation of how the code is supposed to work : I get a pulse of a few ps travelling through optical fibers, due to the non linear contribution of the Kerr effect we observe spectral broadening. And this spectral broadening depends on the energy of the pulse and on the length of fiber travelled. Meaning when I get it through an amplifier stage I get more spectrum.
Here is what I do not get, I defined my sampling parameters this way :
Nsamples=2^16;
TimeWindow=39.5;
Timewin=tau0*TimeWINDOW; %%time window defined as TimeWINDOW*the width of the pulse
dtau=Timewin/Nsamples; %%time steps
Fs=1/dtau; %%Sampling frequency -> Must be superior to 2*Fmax
dF=1/Timewin; %%Frequency window
domega=2*pi*dF; %%angular freq
It works fine until I increase the gain in my amplifier SSF code. However as I understand it my Fmax should be the highest frequency of my window so the lowest wavelength of my spectrum? With I am way under the criteria so I guess a little spectral broadening is enough to get me some spectral aliasing. The issue is I can increase the sampling frequency by reducing the time window but when I reach the criteria my pulse in the time domain can not be described accurately due to its width being larger than the window. Also the closer I get to the frequency the faster my results get damaged.
For TimeWINDOW=10
For TimeWINDOW=5
So I need to increase the amount of samples… I get Nsamples to 2^18 and TimeWINDOW to 15 It should satisfy the criteria yet I still get the following error
And if I increase the gain it will still come faster.
I am kind of lost as to where is my mistake ? I am pretty sure it is an obvious one. Here is how I defined my functions :
%%Pulse building%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function[u_in,s_in,Domega,tau,dtau,omega0,Lambda,P00,Dfreq]=Pulse_generation(pulse_form,Pmoy,freq_pulse,Chirp,tau0,Nsamples,TimeWINDOW,lambda0)
Timewin=tau0*TimeWINDOW; %sqrt(Nsamples)*
dtau=Timewin/Nsamples; %time sep samples
Fs=1/dtau; %frequence d’echantillonage
dF=1/Timewin; %sep freq d’echantillonage
domega=2*pi*dF; %angular freq
%%time space
tau=(-Nsamples/2:(Nsamples/2)-1)*dtau*1e12;
%%frequency space
Dfreq=(-Nsamples/2:1:(Nsamples/2)-1)*dF;
%%spectral space
omega0=2*pi*3e8/lambda0;
dL=2*pi*3e8/omega0^2*domega*1e9;
Domega=(-Nsamples/2:Nsamples/2-1)*domega;
Lambda=((-Nsamples/2:Nsamples/2-1)*dL+lambda0*1e9);
tauFWHM=tau0;
tau0=tauFWHM/(2*sqrt(log(2)));
%%pulse defined
u_gauss=exp(-(1+1i*Chirp).*(((tau.*1e-12).^2)./(2*tau0^2))); %Impulsion gaussienne
u_sech=exp(-(1i*Chirp).*(tau.^2)./(2*tau0^2)).*sech(tau/tau0); %%sech hyp
if(pulse_form == 0)
u_in=u_gauss;
elseif(pulse_form == 1)
u_in=u_sech;
end
%%Normal pulse
%%P0=40e-6;%%probleme de val de P0
%%P0
I00=u_in.^2;
E01=sum(u_in)*dtau;
E0=Pmoy/freq_pulse;
I01=I00./E01*E0;
P00=E0./I00;
u_in=sqrt(E0/E01)*I01;
P00=(freq_pulse)^-1/(sum(u_in.^2)*dtau)*Pmoy;%%erreur dim??
u_in=sqrt(P00)*u_in;
s_in=fftshift(fft(u_in))/Nsamples;
end
%%%SSF%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [u_out,s_out,L_u,L_s]=SSF(u_in,L,beta2,gamma,StepSpatial,Domega,att,g,MapDataSpatial)
[u_out,s_out]=DISP(u_in,beta2,StepSpatial/2,Domega,g);
[u_out,s_out]=KERR(u_out,gamma,StepSpatial);
[u_out,s_out]=DISP(u_out,beta2,StepSpatial/2,Domega,g);
if(MapDataSpatial==1)
L_u=u_out;
L_s=s_out;
end
iii=1;
for ii=2*StepSpatial:StepSpatial:L
iii=iii+1;
[u_out,s_out]=DISP(u_out,beta2,StepSpatial/2,Domega,g);
[u_out,s_out]=KERR(u_out,gamma,StepSpatial);
[u_out,s_out]=DISP(u_out,beta2,StepSpatial/2,Domega,g);
if(MapDataSpatial==1)
L_u=[L_u;u_out];
L_s=[L_s;s_out];
end
end
if(MapDataSpatial~=1)
L_u=0;
L_s=0;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [u_out,s_out]=DISP(u_in,beta2,L,Domega,g)
% mask=zeros(1,length(Domega));
% mask(1000:length(Domega)-1000)=1;
Phidisp=exp(1i*((beta2)/2)*Domega.^2*L+g*L);
s_out=(fftshift(fft(u_in)))/length(u_in).*Phidisp;
%%s_out=s_out.*mask;
u_out=(ifft(ifftshift(s_out)))*length(u_in);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Function non linearity only%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [u_out,s_out]=KERR(u_in,gamma,L)
PhiNL=gamma.*abs(u_in).^2*L;
u_out=u_in.*exp(1i.*PhiNL);%%(g-att)*L
s_out=(fftshift(fft(u_out)))/length(u_out);
end
%%%%%%%
g is the gain, gamma the kerr nonlinear coefficient, beta2 the dispersion coefficient.
Also I have to keep a large frequency bandwidth as I have to include Raman effects later on (Raman effect builds up energy at another wavelength around 13.2THz away so around 1081 nm for me I work at 1030nm).
Best regardsHi,
I am building a code to model a laser with multiple step optical pulse amplifiers, however when I increase the gain I tend to get spectral aliasing. Little explanation of how the code is supposed to work : I get a pulse of a few ps travelling through optical fibers, due to the non linear contribution of the Kerr effect we observe spectral broadening. And this spectral broadening depends on the energy of the pulse and on the length of fiber travelled. Meaning when I get it through an amplifier stage I get more spectrum.
Here is what I do not get, I defined my sampling parameters this way :
Nsamples=2^16;
TimeWindow=39.5;
Timewin=tau0*TimeWINDOW; %%time window defined as TimeWINDOW*the width of the pulse
dtau=Timewin/Nsamples; %%time steps
Fs=1/dtau; %%Sampling frequency -> Must be superior to 2*Fmax
dF=1/Timewin; %%Frequency window
domega=2*pi*dF; %%angular freq
It works fine until I increase the gain in my amplifier SSF code. However as I understand it my Fmax should be the highest frequency of my window so the lowest wavelength of my spectrum? With I am way under the criteria so I guess a little spectral broadening is enough to get me some spectral aliasing. The issue is I can increase the sampling frequency by reducing the time window but when I reach the criteria my pulse in the time domain can not be described accurately due to its width being larger than the window. Also the closer I get to the frequency the faster my results get damaged.
For TimeWINDOW=10
For TimeWINDOW=5
So I need to increase the amount of samples… I get Nsamples to 2^18 and TimeWINDOW to 15 It should satisfy the criteria yet I still get the following error
And if I increase the gain it will still come faster.
I am kind of lost as to where is my mistake ? I am pretty sure it is an obvious one. Here is how I defined my functions :
%%Pulse building%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function[u_in,s_in,Domega,tau,dtau,omega0,Lambda,P00,Dfreq]=Pulse_generation(pulse_form,Pmoy,freq_pulse,Chirp,tau0,Nsamples,TimeWINDOW,lambda0)
Timewin=tau0*TimeWINDOW; %sqrt(Nsamples)*
dtau=Timewin/Nsamples; %time sep samples
Fs=1/dtau; %frequence d’echantillonage
dF=1/Timewin; %sep freq d’echantillonage
domega=2*pi*dF; %angular freq
%%time space
tau=(-Nsamples/2:(Nsamples/2)-1)*dtau*1e12;
%%frequency space
Dfreq=(-Nsamples/2:1:(Nsamples/2)-1)*dF;
%%spectral space
omega0=2*pi*3e8/lambda0;
dL=2*pi*3e8/omega0^2*domega*1e9;
Domega=(-Nsamples/2:Nsamples/2-1)*domega;
Lambda=((-Nsamples/2:Nsamples/2-1)*dL+lambda0*1e9);
tauFWHM=tau0;
tau0=tauFWHM/(2*sqrt(log(2)));
%%pulse defined
u_gauss=exp(-(1+1i*Chirp).*(((tau.*1e-12).^2)./(2*tau0^2))); %Impulsion gaussienne
u_sech=exp(-(1i*Chirp).*(tau.^2)./(2*tau0^2)).*sech(tau/tau0); %%sech hyp
if(pulse_form == 0)
u_in=u_gauss;
elseif(pulse_form == 1)
u_in=u_sech;
end
%%Normal pulse
%%P0=40e-6;%%probleme de val de P0
%%P0
I00=u_in.^2;
E01=sum(u_in)*dtau;
E0=Pmoy/freq_pulse;
I01=I00./E01*E0;
P00=E0./I00;
u_in=sqrt(E0/E01)*I01;
P00=(freq_pulse)^-1/(sum(u_in.^2)*dtau)*Pmoy;%%erreur dim??
u_in=sqrt(P00)*u_in;
s_in=fftshift(fft(u_in))/Nsamples;
end
%%%SSF%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [u_out,s_out,L_u,L_s]=SSF(u_in,L,beta2,gamma,StepSpatial,Domega,att,g,MapDataSpatial)
[u_out,s_out]=DISP(u_in,beta2,StepSpatial/2,Domega,g);
[u_out,s_out]=KERR(u_out,gamma,StepSpatial);
[u_out,s_out]=DISP(u_out,beta2,StepSpatial/2,Domega,g);
if(MapDataSpatial==1)
L_u=u_out;
L_s=s_out;
end
iii=1;
for ii=2*StepSpatial:StepSpatial:L
iii=iii+1;
[u_out,s_out]=DISP(u_out,beta2,StepSpatial/2,Domega,g);
[u_out,s_out]=KERR(u_out,gamma,StepSpatial);
[u_out,s_out]=DISP(u_out,beta2,StepSpatial/2,Domega,g);
if(MapDataSpatial==1)
L_u=[L_u;u_out];
L_s=[L_s;s_out];
end
end
if(MapDataSpatial~=1)
L_u=0;
L_s=0;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [u_out,s_out]=DISP(u_in,beta2,L,Domega,g)
% mask=zeros(1,length(Domega));
% mask(1000:length(Domega)-1000)=1;
Phidisp=exp(1i*((beta2)/2)*Domega.^2*L+g*L);
s_out=(fftshift(fft(u_in)))/length(u_in).*Phidisp;
%%s_out=s_out.*mask;
u_out=(ifft(ifftshift(s_out)))*length(u_in);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Function non linearity only%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [u_out,s_out]=KERR(u_in,gamma,L)
PhiNL=gamma.*abs(u_in).^2*L;
u_out=u_in.*exp(1i.*PhiNL);%%(g-att)*L
s_out=(fftshift(fft(u_out)))/length(u_out);
end
%%%%%%%
g is the gain, gamma the kerr nonlinear coefficient, beta2 the dispersion coefficient.
Also I have to keep a large frequency bandwidth as I have to include Raman effects later on (Raman effect builds up energy at another wavelength around 13.2THz away so around 1081 nm for me I work at 1030nm).
Best regards Hi,
I am building a code to model a laser with multiple step optical pulse amplifiers, however when I increase the gain I tend to get spectral aliasing. Little explanation of how the code is supposed to work : I get a pulse of a few ps travelling through optical fibers, due to the non linear contribution of the Kerr effect we observe spectral broadening. And this spectral broadening depends on the energy of the pulse and on the length of fiber travelled. Meaning when I get it through an amplifier stage I get more spectrum.
Here is what I do not get, I defined my sampling parameters this way :
Nsamples=2^16;
TimeWindow=39.5;
Timewin=tau0*TimeWINDOW; %%time window defined as TimeWINDOW*the width of the pulse
dtau=Timewin/Nsamples; %%time steps
Fs=1/dtau; %%Sampling frequency -> Must be superior to 2*Fmax
dF=1/Timewin; %%Frequency window
domega=2*pi*dF; %%angular freq
It works fine until I increase the gain in my amplifier SSF code. However as I understand it my Fmax should be the highest frequency of my window so the lowest wavelength of my spectrum? With I am way under the criteria so I guess a little spectral broadening is enough to get me some spectral aliasing. The issue is I can increase the sampling frequency by reducing the time window but when I reach the criteria my pulse in the time domain can not be described accurately due to its width being larger than the window. Also the closer I get to the frequency the faster my results get damaged.
For TimeWINDOW=10
For TimeWINDOW=5
So I need to increase the amount of samples… I get Nsamples to 2^18 and TimeWINDOW to 15 It should satisfy the criteria yet I still get the following error
And if I increase the gain it will still come faster.
I am kind of lost as to where is my mistake ? I am pretty sure it is an obvious one. Here is how I defined my functions :
%%Pulse building%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function[u_in,s_in,Domega,tau,dtau,omega0,Lambda,P00,Dfreq]=Pulse_generation(pulse_form,Pmoy,freq_pulse,Chirp,tau0,Nsamples,TimeWINDOW,lambda0)
Timewin=tau0*TimeWINDOW; %sqrt(Nsamples)*
dtau=Timewin/Nsamples; %time sep samples
Fs=1/dtau; %frequence d’echantillonage
dF=1/Timewin; %sep freq d’echantillonage
domega=2*pi*dF; %angular freq
%%time space
tau=(-Nsamples/2:(Nsamples/2)-1)*dtau*1e12;
%%frequency space
Dfreq=(-Nsamples/2:1:(Nsamples/2)-1)*dF;
%%spectral space
omega0=2*pi*3e8/lambda0;
dL=2*pi*3e8/omega0^2*domega*1e9;
Domega=(-Nsamples/2:Nsamples/2-1)*domega;
Lambda=((-Nsamples/2:Nsamples/2-1)*dL+lambda0*1e9);
tauFWHM=tau0;
tau0=tauFWHM/(2*sqrt(log(2)));
%%pulse defined
u_gauss=exp(-(1+1i*Chirp).*(((tau.*1e-12).^2)./(2*tau0^2))); %Impulsion gaussienne
u_sech=exp(-(1i*Chirp).*(tau.^2)./(2*tau0^2)).*sech(tau/tau0); %%sech hyp
if(pulse_form == 0)
u_in=u_gauss;
elseif(pulse_form == 1)
u_in=u_sech;
end
%%Normal pulse
%%P0=40e-6;%%probleme de val de P0
%%P0
I00=u_in.^2;
E01=sum(u_in)*dtau;
E0=Pmoy/freq_pulse;
I01=I00./E01*E0;
P00=E0./I00;
u_in=sqrt(E0/E01)*I01;
P00=(freq_pulse)^-1/(sum(u_in.^2)*dtau)*Pmoy;%%erreur dim??
u_in=sqrt(P00)*u_in;
s_in=fftshift(fft(u_in))/Nsamples;
end
%%%SSF%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [u_out,s_out,L_u,L_s]=SSF(u_in,L,beta2,gamma,StepSpatial,Domega,att,g,MapDataSpatial)
[u_out,s_out]=DISP(u_in,beta2,StepSpatial/2,Domega,g);
[u_out,s_out]=KERR(u_out,gamma,StepSpatial);
[u_out,s_out]=DISP(u_out,beta2,StepSpatial/2,Domega,g);
if(MapDataSpatial==1)
L_u=u_out;
L_s=s_out;
end
iii=1;
for ii=2*StepSpatial:StepSpatial:L
iii=iii+1;
[u_out,s_out]=DISP(u_out,beta2,StepSpatial/2,Domega,g);
[u_out,s_out]=KERR(u_out,gamma,StepSpatial);
[u_out,s_out]=DISP(u_out,beta2,StepSpatial/2,Domega,g);
if(MapDataSpatial==1)
L_u=[L_u;u_out];
L_s=[L_s;s_out];
end
end
if(MapDataSpatial~=1)
L_u=0;
L_s=0;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [u_out,s_out]=DISP(u_in,beta2,L,Domega,g)
% mask=zeros(1,length(Domega));
% mask(1000:length(Domega)-1000)=1;
Phidisp=exp(1i*((beta2)/2)*Domega.^2*L+g*L);
s_out=(fftshift(fft(u_in)))/length(u_in).*Phidisp;
%%s_out=s_out.*mask;
u_out=(ifft(ifftshift(s_out)))*length(u_in);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Function non linearity only%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [u_out,s_out]=KERR(u_in,gamma,L)
PhiNL=gamma.*abs(u_in).^2*L;
u_out=u_in.*exp(1i.*PhiNL);%%(g-att)*L
s_out=(fftshift(fft(u_out)))/length(u_out);
end
%%%%%%%
g is the gain, gamma the kerr nonlinear coefficient, beta2 the dispersion coefficient.
Also I have to keep a large frequency bandwidth as I have to include Raman effects later on (Raman effect builds up energy at another wavelength around 13.2THz away so around 1081 nm for me I work at 1030nm).
Best regards matlab, fft, optics MATLAB Answers — New Questions
Find maximum of an array in a for loop?
I need to calculate the maximum of each array from the load variable in the following for loop.
myDir = uigetdir;
myFiles = dir(fullfile(myDir,’*.txt’));
for k = 1:length(myFiles)
baseFileName = myFiles(k).name;
fullFileName = fullfile(myDir, baseFileName);
fprintf(1, ‘Now reading %sn’, fullFileName);
num = readmatrix(fullFileName);
load = num(:,1)
ext = num(:,3)
plot(ext,load); hold on
grid on;
endI need to calculate the maximum of each array from the load variable in the following for loop.
myDir = uigetdir;
myFiles = dir(fullfile(myDir,’*.txt’));
for k = 1:length(myFiles)
baseFileName = myFiles(k).name;
fullFileName = fullfile(myDir, baseFileName);
fprintf(1, ‘Now reading %sn’, fullFileName);
num = readmatrix(fullFileName);
load = num(:,1)
ext = num(:,3)
plot(ext,load); hold on
grid on;
end I need to calculate the maximum of each array from the load variable in the following for loop.
myDir = uigetdir;
myFiles = dir(fullfile(myDir,’*.txt’));
for k = 1:length(myFiles)
baseFileName = myFiles(k).name;
fullFileName = fullfile(myDir, baseFileName);
fprintf(1, ‘Now reading %sn’, fullFileName);
num = readmatrix(fullFileName);
load = num(:,1)
ext = num(:,3)
plot(ext,load); hold on
grid on;
end for loop, max MATLAB Answers — New Questions
Cannot save file in Matlab online(Basic)
I could create new scripts and run them and save them with a filename in MATLAB online (basic), the free 20hr a month version before. But today I cannot save any files or rename them. I hadnt used MATLAB in a couple of months before today. So i am not sure what is wrong. Tried restarting, did not help.I could create new scripts and run them and save them with a filename in MATLAB online (basic), the free 20hr a month version before. But today I cannot save any files or rename them. I hadnt used MATLAB in a couple of months before today. So i am not sure what is wrong. Tried restarting, did not help. I could create new scripts and run them and save them with a filename in MATLAB online (basic), the free 20hr a month version before. But today I cannot save any files or rename them. I hadnt used MATLAB in a couple of months before today. So i am not sure what is wrong. Tried restarting, did not help. save, matlab MATLAB Answers — New Questions
rlValueFunction error: The number of network input layers must be equal to the number of observation channels in the environment specification object.
Hi,
I am currently training the biped robot with PPO algorithm. I used rlValueFunction to create critic, but it keep shows this error:
Error using rl.internal.validate.mapFunctionObservationInput (line 5)
The number of network input layers must be equal to the number of observation channels in the
environment specification object.
Error in rlValueFunction (line 81)
model = rl.internal.validate.mapFunctionObservationInput(model,observationInfo,…
Error in createPPONetworks (line 219)
critic = rlValueFunction(criticNetwork,env.getObservationInfo)
The critic network code and plot image is below:
criticLayerSizes = [600,400]; %400,300
statePath = [
imageInputLayer([31 1 1],’Normalization’,’none’,’Name’, ‘observation’)
fullyConnectedLayer(criticLayerSizes(1), ‘Name’, ‘CriticStateFC1’, …
‘Weights’,2/sqrt(31)*(rand(criticLayerSizes(1),31)-0.5), …
‘Bias’,2/sqrt(31)*(rand(criticLayerSizes(1),1)-0.5))
reluLayer(‘Name’,’CriticStateRelu1′)
fullyConnectedLayer(criticLayerSizes(2), ‘Name’, ‘CriticStateFC2’, …
‘Weights’,2/sqrt(criticLayerSizes(1))*(rand(criticLayerSizes(2),criticLayerSizes(1))-0.5), …
‘Bias’,2/sqrt(criticLayerSizes(1))*(rand(criticLayerSizes(2),1)-0.5))
];
actionPath = [
imageInputLayer([6 1 1],’Normalization’,’none’, ‘Name’, ‘action’) %numAct
fullyConnectedLayer(criticLayerSizes(2), ‘Name’, ‘CriticActionFC1’, …
‘Weights’,2/sqrt(6)*(rand(criticLayerSizes(2),6)-0.5), …
‘Bias’,2/sqrt(6)*(rand(criticLayerSizes(2),1)-0.5))
];
commonPath = [
additionLayer(2,’Name’,’add’)
reluLayer(‘Name’,’CriticCommonRelu1′)
fullyConnectedLayer(1, ‘Name’, ‘CriticOutput’,…
‘Weights’,2*5e-3*(rand(1,criticLayerSizes(2))-0.5), …
‘Bias’,2*5e-3*(rand(1,1)-0.5))
];
% Connect the layer graph
criticNetwork = layerGraph(statePath);
criticNetwork = addLayers(criticNetwork, actionPath);
criticNetwork = addLayers(criticNetwork, commonPath);
criticNetwork = connectLayers(criticNetwork,’CriticStateFC2′,’add/in1′);
criticNetwork = connectLayers(criticNetwork,’CriticActionFC1′,’add/in2′);
plot(criticNetwork)
% Create critic representation
criticOptions = rlRepresentationOptions(‘Optimizer’,’adam’,’LearnRate’,1e-3, …
‘GradientThreshold’,1,’L2RegularizationFactor’,2e-4);
if useGPU
%criticOptions.UseDevice = ‘gpu’;
end
critic = rlValueFunction(criticNetwork,env.getObservationInfo)
I couldn’t find why that error occurs. Can anyone please offer me some guidance regarding this problem? Thank you very much.Hi,
I am currently training the biped robot with PPO algorithm. I used rlValueFunction to create critic, but it keep shows this error:
Error using rl.internal.validate.mapFunctionObservationInput (line 5)
The number of network input layers must be equal to the number of observation channels in the
environment specification object.
Error in rlValueFunction (line 81)
model = rl.internal.validate.mapFunctionObservationInput(model,observationInfo,…
Error in createPPONetworks (line 219)
critic = rlValueFunction(criticNetwork,env.getObservationInfo)
The critic network code and plot image is below:
criticLayerSizes = [600,400]; %400,300
statePath = [
imageInputLayer([31 1 1],’Normalization’,’none’,’Name’, ‘observation’)
fullyConnectedLayer(criticLayerSizes(1), ‘Name’, ‘CriticStateFC1’, …
‘Weights’,2/sqrt(31)*(rand(criticLayerSizes(1),31)-0.5), …
‘Bias’,2/sqrt(31)*(rand(criticLayerSizes(1),1)-0.5))
reluLayer(‘Name’,’CriticStateRelu1′)
fullyConnectedLayer(criticLayerSizes(2), ‘Name’, ‘CriticStateFC2’, …
‘Weights’,2/sqrt(criticLayerSizes(1))*(rand(criticLayerSizes(2),criticLayerSizes(1))-0.5), …
‘Bias’,2/sqrt(criticLayerSizes(1))*(rand(criticLayerSizes(2),1)-0.5))
];
actionPath = [
imageInputLayer([6 1 1],’Normalization’,’none’, ‘Name’, ‘action’) %numAct
fullyConnectedLayer(criticLayerSizes(2), ‘Name’, ‘CriticActionFC1’, …
‘Weights’,2/sqrt(6)*(rand(criticLayerSizes(2),6)-0.5), …
‘Bias’,2/sqrt(6)*(rand(criticLayerSizes(2),1)-0.5))
];
commonPath = [
additionLayer(2,’Name’,’add’)
reluLayer(‘Name’,’CriticCommonRelu1′)
fullyConnectedLayer(1, ‘Name’, ‘CriticOutput’,…
‘Weights’,2*5e-3*(rand(1,criticLayerSizes(2))-0.5), …
‘Bias’,2*5e-3*(rand(1,1)-0.5))
];
% Connect the layer graph
criticNetwork = layerGraph(statePath);
criticNetwork = addLayers(criticNetwork, actionPath);
criticNetwork = addLayers(criticNetwork, commonPath);
criticNetwork = connectLayers(criticNetwork,’CriticStateFC2′,’add/in1′);
criticNetwork = connectLayers(criticNetwork,’CriticActionFC1′,’add/in2′);
plot(criticNetwork)
% Create critic representation
criticOptions = rlRepresentationOptions(‘Optimizer’,’adam’,’LearnRate’,1e-3, …
‘GradientThreshold’,1,’L2RegularizationFactor’,2e-4);
if useGPU
%criticOptions.UseDevice = ‘gpu’;
end
critic = rlValueFunction(criticNetwork,env.getObservationInfo)
I couldn’t find why that error occurs. Can anyone please offer me some guidance regarding this problem? Thank you very much. Hi,
I am currently training the biped robot with PPO algorithm. I used rlValueFunction to create critic, but it keep shows this error:
Error using rl.internal.validate.mapFunctionObservationInput (line 5)
The number of network input layers must be equal to the number of observation channels in the
environment specification object.
Error in rlValueFunction (line 81)
model = rl.internal.validate.mapFunctionObservationInput(model,observationInfo,…
Error in createPPONetworks (line 219)
critic = rlValueFunction(criticNetwork,env.getObservationInfo)
The critic network code and plot image is below:
criticLayerSizes = [600,400]; %400,300
statePath = [
imageInputLayer([31 1 1],’Normalization’,’none’,’Name’, ‘observation’)
fullyConnectedLayer(criticLayerSizes(1), ‘Name’, ‘CriticStateFC1’, …
‘Weights’,2/sqrt(31)*(rand(criticLayerSizes(1),31)-0.5), …
‘Bias’,2/sqrt(31)*(rand(criticLayerSizes(1),1)-0.5))
reluLayer(‘Name’,’CriticStateRelu1′)
fullyConnectedLayer(criticLayerSizes(2), ‘Name’, ‘CriticStateFC2’, …
‘Weights’,2/sqrt(criticLayerSizes(1))*(rand(criticLayerSizes(2),criticLayerSizes(1))-0.5), …
‘Bias’,2/sqrt(criticLayerSizes(1))*(rand(criticLayerSizes(2),1)-0.5))
];
actionPath = [
imageInputLayer([6 1 1],’Normalization’,’none’, ‘Name’, ‘action’) %numAct
fullyConnectedLayer(criticLayerSizes(2), ‘Name’, ‘CriticActionFC1’, …
‘Weights’,2/sqrt(6)*(rand(criticLayerSizes(2),6)-0.5), …
‘Bias’,2/sqrt(6)*(rand(criticLayerSizes(2),1)-0.5))
];
commonPath = [
additionLayer(2,’Name’,’add’)
reluLayer(‘Name’,’CriticCommonRelu1′)
fullyConnectedLayer(1, ‘Name’, ‘CriticOutput’,…
‘Weights’,2*5e-3*(rand(1,criticLayerSizes(2))-0.5), …
‘Bias’,2*5e-3*(rand(1,1)-0.5))
];
% Connect the layer graph
criticNetwork = layerGraph(statePath);
criticNetwork = addLayers(criticNetwork, actionPath);
criticNetwork = addLayers(criticNetwork, commonPath);
criticNetwork = connectLayers(criticNetwork,’CriticStateFC2′,’add/in1′);
criticNetwork = connectLayers(criticNetwork,’CriticActionFC1′,’add/in2′);
plot(criticNetwork)
% Create critic representation
criticOptions = rlRepresentationOptions(‘Optimizer’,’adam’,’LearnRate’,1e-3, …
‘GradientThreshold’,1,’L2RegularizationFactor’,2e-4);
if useGPU
%criticOptions.UseDevice = ‘gpu’;
end
critic = rlValueFunction(criticNetwork,env.getObservationInfo)
I couldn’t find why that error occurs. Can anyone please offer me some guidance regarding this problem? Thank you very much. rlvaluefunction, reinforcement learning, rl, rlppoagent, ppo MATLAB Answers — New Questions
如何定义一个符号变量间的大小, 并把这些符号元素排序
syms c1 c2 c3;
abs(c1) >= abs(c2) >= abs(c3)
a = 1/4 – c2/4 – c3/4 – c1/4;
b = c2/4 – c1/4 + c3/4 + 1/4;
c = c1/4 – c2/4 + c3/4 + 1/4;
d = c1/4 + c2/4 – c3/4 + 1/4;
A = [a,b,c,d];
A_asc = sort(A)syms c1 c2 c3;
abs(c1) >= abs(c2) >= abs(c3)
a = 1/4 – c2/4 – c3/4 – c1/4;
b = c2/4 – c1/4 + c3/4 + 1/4;
c = c1/4 – c2/4 + c3/4 + 1/4;
d = c1/4 + c2/4 – c3/4 + 1/4;
A = [a,b,c,d];
A_asc = sort(A) syms c1 c2 c3;
abs(c1) >= abs(c2) >= abs(c3)
a = 1/4 – c2/4 – c3/4 – c1/4;
b = c2/4 – c1/4 + c3/4 + 1/4;
c = c1/4 – c2/4 + c3/4 + 1/4;
d = c1/4 + c2/4 – c3/4 + 1/4;
A = [a,b,c,d];
A_asc = sort(A) sort,, 排序 MATLAB Answers — New Questions
Matlab will only print script name in the command prompt, but not run the matlab script.
I’m fairly new to matlab, but have written a piece of code, and while there aren’t any problems with the code when I run it on another system, I’ve been unable to run the script on the computer I would like since it will only print the file name rather then running the code. I’ve tried reinstalling matlab on this computer and this also does not seem to fix thte problem. The reason for using this computer is that it has the specifications for the task desired. The problem seems to be with running the script itself through the editor, help would be greatly apprecieated!I’m fairly new to matlab, but have written a piece of code, and while there aren’t any problems with the code when I run it on another system, I’ve been unable to run the script on the computer I would like since it will only print the file name rather then running the code. I’ve tried reinstalling matlab on this computer and this also does not seem to fix thte problem. The reason for using this computer is that it has the specifications for the task desired. The problem seems to be with running the script itself through the editor, help would be greatly apprecieated! I’m fairly new to matlab, but have written a piece of code, and while there aren’t any problems with the code when I run it on another system, I’ve been unable to run the script on the computer I would like since it will only print the file name rather then running the code. I’ve tried reinstalling matlab on this computer and this also does not seem to fix thte problem. The reason for using this computer is that it has the specifications for the task desired. The problem seems to be with running the script itself through the editor, help would be greatly apprecieated! matlab, editor, for loop MATLAB Answers — New Questions
Colour interference when two surfaces overlap
Colour interference when two surfaces overlap, how to solve it?Colour interference when two surfaces overlap, how to solve it? Colour interference when two surfaces overlap, how to solve it? surf MATLAB Answers — New Questions
Pack (Generated Block) BatteryBuilder: How can I limit my SOC from 0 to 1
I use the new battery simscape blocks for a battery simulation. Now I want to limit the SOC from 1 to 0. Actually I want to limit the single cell voltage (4.2V to 2.5V). Is this possible via the parameter table or do you have any other suggestions?
The saturator block in the Figure is actually only used to embellish my graphics and not to limit the voltage.
That only a maximum of 4.2 volts are available with a SOC of 1.
Properties: CellV = 4.2 V 24s5p with 8 Module in the packI use the new battery simscape blocks for a battery simulation. Now I want to limit the SOC from 1 to 0. Actually I want to limit the single cell voltage (4.2V to 2.5V). Is this possible via the parameter table or do you have any other suggestions?
The saturator block in the Figure is actually only used to embellish my graphics and not to limit the voltage.
That only a maximum of 4.2 volts are available with a SOC of 1.
Properties: CellV = 4.2 V 24s5p with 8 Module in the pack I use the new battery simscape blocks for a battery simulation. Now I want to limit the SOC from 1 to 0. Actually I want to limit the single cell voltage (4.2V to 2.5V). Is this possible via the parameter table or do you have any other suggestions?
The saturator block in the Figure is actually only used to embellish my graphics and not to limit the voltage.
That only a maximum of 4.2 volts are available with a SOC of 1.
Properties: CellV = 4.2 V 24s5p with 8 Module in the pack batterybuilder, pack, simscape battery, batterymodel, buildbattery MATLAB Answers — New Questions
MATLAB Programming Techniques, Extracting Portions of a table
Hello,
in the course "Programming Techniques" theses lines show how you can extract portions of a table:
https://matlabacademy.mathworks.com/R2024a/portal.html?course=mlpr#chapter=2&lesson=4§ion=2
t2 = t1(6:15,[1 5 end-1:end])
or
t2 = t1(6:15,["A" "E" "N" "O"])
Why do I need
end-1:end
in the first version?
LisaHello,
in the course "Programming Techniques" theses lines show how you can extract portions of a table:
https://matlabacademy.mathworks.com/R2024a/portal.html?course=mlpr#chapter=2&lesson=4§ion=2
t2 = t1(6:15,[1 5 end-1:end])
or
t2 = t1(6:15,["A" "E" "N" "O"])
Why do I need
end-1:end
in the first version?
Lisa Hello,
in the course "Programming Techniques" theses lines show how you can extract portions of a table:
https://matlabacademy.mathworks.com/R2024a/portal.html?course=mlpr#chapter=2&lesson=4§ion=2
t2 = t1(6:15,[1 5 end-1:end])
or
t2 = t1(6:15,["A" "E" "N" "O"])
Why do I need
end-1:end
in the first version?
Lisa table, extract data MATLAB Answers — New Questions