Month: August 2024
Trouble with an array
Hello,
I have some trouble with an array. I try to set the values for a 3D array (nx x ny x nz) that all inner nodes are set to a defined value, all surface nodes (except the edge nodes) are set to a defined value too. It’s like a small cube in a greater cube.
Here is the code I used:
clc;
clear all;
clf;
format short g
fontSize = 18;
% Domaine
L=0.1;
B=0.1;
H=0.1;
nx=5;
ny=5;
nz=5;
dx=L/(nx-1);
dy=B/(ny-1);
dz=H/(nz-1);
% Nodes
Tn=zeros(nx,ny,nz);
x=linspace(0,L,nx);
y=linspace(0,H,ny);
z=linspace(0,B,nz);
[X,Y,Z]=meshgrid(x,y,z);
K=zeros(nx,ny,nz);
K([1 end],:,:)=alpha;
K(:,[1 end],:)=alpha;
K(:,:,[1 end])=alpha;
% inner nodes
T=zeros(nx,ny,nz);
T(:,:,:)=700;
t=0;
% surrounding surfaces
Tu=600; % bottom
To=900; % top
Tl=400; % left
Tr=800; % rigth
Tv=300; % front
Th=300; % back
% side surfaces
Tn(1,2:nx-2,2:nz-2)=Tv; % front
Tn(ny,2:nx-2,2:nz-2)=Th; % back
Tn(2:ny-2,2:nx-2,1)=Tu; % bottom
Tn(2:ny-2,2:nx-2,nz)=To; % top
Tn(2:ny-2,1,2:nz-2)=Tl; % left
Tn(2:ny-2,nx,2:nz-2)=Tr; % rigth
% merge inner nodes
Tn(2:ny-2,2:nx-2,2:nz-2) = T(2:ny-2,2:nx-2,2:nz-2);
f = figure(1);
f.Position(3:4) = [1080 840];
%XY
subplot(2,2,1)
slice(X,Y,Z,Tn,[],[],[0,H],’cubic’);
set(gca,’FontSize’,fontSize)
colormap(jet)
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H]);
view(30,30);
% XZ
subplot(2,2,2)
slice(X,Y,Z,Tn,[],[0,B],[],’cubic’);
set(gca,’FontSize’,fontSize)
colormap(jet)
%set ( gca, ‘ydir’, ‘reverse’ )
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H]);
view(30,30);
% YZ
subplot(2,2,3)
slice(X,Y,Z,Tn,[0,L],[],[],’cubic’);
set(gca,’FontSize’,fontSize)
colormap(jet)
%set ( gca, ‘ydir’, ‘reverse’ )
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H]);
view(30,30);
% 3D
subplot(2,2,4)
slice(X,Y,Z,Tn,[0,L/2],[B/2,B],[0],’linear’);
set(gca,’FontSize’,fontSize)
set(gca,’YDir’,’normal’)
colormap(jet)
set ( gca, ‘xdir’, ‘reverse’ )
set ( gca, ‘ydir’, ‘reverse’ )
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H])
view(-150,30);
hold on
%shading(gca,’interp’)
p = get(subplot(2,2,4),’Position’);
cb=colorbar(‘Position’, [0.93 0.25 0.025 0.6]);
set(cb,’FontSize’,fontSize);
caxis([0, 900]);
The result I achieve is this:
I marked the false areas with a red sign. I indexed from 2:nx-1 and so on, but it’s not working.
The result should look like this:
I don’t know where the error is. Maybe someone has a clue how to fix this.
Greetings
SteffenHello,
I have some trouble with an array. I try to set the values for a 3D array (nx x ny x nz) that all inner nodes are set to a defined value, all surface nodes (except the edge nodes) are set to a defined value too. It’s like a small cube in a greater cube.
Here is the code I used:
clc;
clear all;
clf;
format short g
fontSize = 18;
% Domaine
L=0.1;
B=0.1;
H=0.1;
nx=5;
ny=5;
nz=5;
dx=L/(nx-1);
dy=B/(ny-1);
dz=H/(nz-1);
% Nodes
Tn=zeros(nx,ny,nz);
x=linspace(0,L,nx);
y=linspace(0,H,ny);
z=linspace(0,B,nz);
[X,Y,Z]=meshgrid(x,y,z);
K=zeros(nx,ny,nz);
K([1 end],:,:)=alpha;
K(:,[1 end],:)=alpha;
K(:,:,[1 end])=alpha;
% inner nodes
T=zeros(nx,ny,nz);
T(:,:,:)=700;
t=0;
% surrounding surfaces
Tu=600; % bottom
To=900; % top
Tl=400; % left
Tr=800; % rigth
Tv=300; % front
Th=300; % back
% side surfaces
Tn(1,2:nx-2,2:nz-2)=Tv; % front
Tn(ny,2:nx-2,2:nz-2)=Th; % back
Tn(2:ny-2,2:nx-2,1)=Tu; % bottom
Tn(2:ny-2,2:nx-2,nz)=To; % top
Tn(2:ny-2,1,2:nz-2)=Tl; % left
Tn(2:ny-2,nx,2:nz-2)=Tr; % rigth
% merge inner nodes
Tn(2:ny-2,2:nx-2,2:nz-2) = T(2:ny-2,2:nx-2,2:nz-2);
f = figure(1);
f.Position(3:4) = [1080 840];
%XY
subplot(2,2,1)
slice(X,Y,Z,Tn,[],[],[0,H],’cubic’);
set(gca,’FontSize’,fontSize)
colormap(jet)
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H]);
view(30,30);
% XZ
subplot(2,2,2)
slice(X,Y,Z,Tn,[],[0,B],[],’cubic’);
set(gca,’FontSize’,fontSize)
colormap(jet)
%set ( gca, ‘ydir’, ‘reverse’ )
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H]);
view(30,30);
% YZ
subplot(2,2,3)
slice(X,Y,Z,Tn,[0,L],[],[],’cubic’);
set(gca,’FontSize’,fontSize)
colormap(jet)
%set ( gca, ‘ydir’, ‘reverse’ )
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H]);
view(30,30);
% 3D
subplot(2,2,4)
slice(X,Y,Z,Tn,[0,L/2],[B/2,B],[0],’linear’);
set(gca,’FontSize’,fontSize)
set(gca,’YDir’,’normal’)
colormap(jet)
set ( gca, ‘xdir’, ‘reverse’ )
set ( gca, ‘ydir’, ‘reverse’ )
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H])
view(-150,30);
hold on
%shading(gca,’interp’)
p = get(subplot(2,2,4),’Position’);
cb=colorbar(‘Position’, [0.93 0.25 0.025 0.6]);
set(cb,’FontSize’,fontSize);
caxis([0, 900]);
The result I achieve is this:
I marked the false areas with a red sign. I indexed from 2:nx-1 and so on, but it’s not working.
The result should look like this:
I don’t know where the error is. Maybe someone has a clue how to fix this.
Greetings
Steffen Hello,
I have some trouble with an array. I try to set the values for a 3D array (nx x ny x nz) that all inner nodes are set to a defined value, all surface nodes (except the edge nodes) are set to a defined value too. It’s like a small cube in a greater cube.
Here is the code I used:
clc;
clear all;
clf;
format short g
fontSize = 18;
% Domaine
L=0.1;
B=0.1;
H=0.1;
nx=5;
ny=5;
nz=5;
dx=L/(nx-1);
dy=B/(ny-1);
dz=H/(nz-1);
% Nodes
Tn=zeros(nx,ny,nz);
x=linspace(0,L,nx);
y=linspace(0,H,ny);
z=linspace(0,B,nz);
[X,Y,Z]=meshgrid(x,y,z);
K=zeros(nx,ny,nz);
K([1 end],:,:)=alpha;
K(:,[1 end],:)=alpha;
K(:,:,[1 end])=alpha;
% inner nodes
T=zeros(nx,ny,nz);
T(:,:,:)=700;
t=0;
% surrounding surfaces
Tu=600; % bottom
To=900; % top
Tl=400; % left
Tr=800; % rigth
Tv=300; % front
Th=300; % back
% side surfaces
Tn(1,2:nx-2,2:nz-2)=Tv; % front
Tn(ny,2:nx-2,2:nz-2)=Th; % back
Tn(2:ny-2,2:nx-2,1)=Tu; % bottom
Tn(2:ny-2,2:nx-2,nz)=To; % top
Tn(2:ny-2,1,2:nz-2)=Tl; % left
Tn(2:ny-2,nx,2:nz-2)=Tr; % rigth
% merge inner nodes
Tn(2:ny-2,2:nx-2,2:nz-2) = T(2:ny-2,2:nx-2,2:nz-2);
f = figure(1);
f.Position(3:4) = [1080 840];
%XY
subplot(2,2,1)
slice(X,Y,Z,Tn,[],[],[0,H],’cubic’);
set(gca,’FontSize’,fontSize)
colormap(jet)
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H]);
view(30,30);
% XZ
subplot(2,2,2)
slice(X,Y,Z,Tn,[],[0,B],[],’cubic’);
set(gca,’FontSize’,fontSize)
colormap(jet)
%set ( gca, ‘ydir’, ‘reverse’ )
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H]);
view(30,30);
% YZ
subplot(2,2,3)
slice(X,Y,Z,Tn,[0,L],[],[],’cubic’);
set(gca,’FontSize’,fontSize)
colormap(jet)
%set ( gca, ‘ydir’, ‘reverse’ )
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H]);
view(30,30);
% 3D
subplot(2,2,4)
slice(X,Y,Z,Tn,[0,L/2],[B/2,B],[0],’linear’);
set(gca,’FontSize’,fontSize)
set(gca,’YDir’,’normal’)
colormap(jet)
set ( gca, ‘xdir’, ‘reverse’ )
set ( gca, ‘ydir’, ‘reverse’ )
xlabel(‘X -Axis’,’FontSize’, fontSize)
ylabel(‘Y -Axis’,’FontSize’, fontSize)
zlabel(‘Z -Axis’,’FontSize’, fontSize)
axis([0 L 0 B 0 H])
view(-150,30);
hold on
%shading(gca,’interp’)
p = get(subplot(2,2,4),’Position’);
cb=colorbar(‘Position’, [0.93 0.25 0.025 0.6]);
set(cb,’FontSize’,fontSize);
caxis([0, 900]);
The result I achieve is this:
I marked the false areas with a red sign. I indexed from 2:nx-1 and so on, but it’s not working.
The result should look like this:
I don’t know where the error is. Maybe someone has a clue how to fix this.
Greetings
Steffen array, indexing MATLAB Answers — New Questions
n-dimensional Polyhedron plotting using 2-dimensional plot commamnd
I have a 4-dimensional system with 4 states x=(x1, x2, x3,x4) as follow:
A =[ 0 1 0 0
0 -6.7811 203.43 1.6275
0 0 0 1
0 0.89105 -26.732 -6.8804];
B =[ 0
101.72
0
61.26];
xmin = [-2; -5;-4; -2];xmax = [0; 50; 10; 10];
umin =-5;umax =5;
and a I must plot a Polyhedron as follow only for x1 , x2
X = Polyhedron(‘lb’,model.x.min,’ub’,model.x.max);
above-mentionaed Polyhedron is 4-dimentional and it is not possible to plot it.
i want to plot this polyhedron in 2-dimensional page only for x1 and x2 states such that x1 state is considered as horizontal axis and x2 state is considered as vertical axis.
How can I do that in Matlab?I have a 4-dimensional system with 4 states x=(x1, x2, x3,x4) as follow:
A =[ 0 1 0 0
0 -6.7811 203.43 1.6275
0 0 0 1
0 0.89105 -26.732 -6.8804];
B =[ 0
101.72
0
61.26];
xmin = [-2; -5;-4; -2];xmax = [0; 50; 10; 10];
umin =-5;umax =5;
and a I must plot a Polyhedron as follow only for x1 , x2
X = Polyhedron(‘lb’,model.x.min,’ub’,model.x.max);
above-mentionaed Polyhedron is 4-dimentional and it is not possible to plot it.
i want to plot this polyhedron in 2-dimensional page only for x1 and x2 states such that x1 state is considered as horizontal axis and x2 state is considered as vertical axis.
How can I do that in Matlab? I have a 4-dimensional system with 4 states x=(x1, x2, x3,x4) as follow:
A =[ 0 1 0 0
0 -6.7811 203.43 1.6275
0 0 0 1
0 0.89105 -26.732 -6.8804];
B =[ 0
101.72
0
61.26];
xmin = [-2; -5;-4; -2];xmax = [0; 50; 10; 10];
umin =-5;umax =5;
and a I must plot a Polyhedron as follow only for x1 , x2
X = Polyhedron(‘lb’,model.x.min,’ub’,model.x.max);
above-mentionaed Polyhedron is 4-dimentional and it is not possible to plot it.
i want to plot this polyhedron in 2-dimensional page only for x1 and x2 states such that x1 state is considered as horizontal axis and x2 state is considered as vertical axis.
How can I do that in Matlab? polyhedron, mpc MATLAB Answers — New Questions
Cannot figure out how to fit a complicated custom equation.
I am having trouble implementing this equation into the curve fitting toolbox, both in the command and by utilizing the curve fitting GUI.
A little background that may help explain this:
I am wanting to fit experimental data of T(K) vs K_ph (W/m K) which the thermal conductivity of a material, to a model from a journal paper. I have done an okay job in python with scipy.optimize but have been trying MATLAB for a more accurate method.
I have this equation I need to fit
where
A, B, b, C_1, C_2, D, Omega_res1, Omega_res2, and L (ignore L in the exmaple code) are all coefficients I want solved for.
Omega is the independent variable in the integral (omega is solved for) while T is the range 1 to 100 in 1K steps. Or T can simply be my experimental Temperature data as is in my code.
My problems (in the GUI) are in the ways to set the values for T and use an integral in the custom equation box. As in, I am not sure how to tyep the equation in the way MATLAB accepts in the GUI for the toolbox.
My problems for the code is in the integration and lsqcurve fit it seems. I have a lot of warnings/errors such as
Warning: Derivative finite-differencing step was artificially reduced to be within bound constraints. This may
adversely affect convergence. Increasing distance between bound constraints, in dimension 6, to be at least 2e-20
may improve results.
Local minimum possible.
lsqcurvefit stopped because the size of the current step is less than
the value of the step size tolerance.
<stopping criteria details>
Fitted Parameters:
D = 1e-40
B = 1e-20
A = 1e-15
b = 100
C1 = 1e-40
C2 = 1e-40
I am not sure how to fix these, I have gone through other posts on similar matters and have changed the bounds and manually changed the optimoptions values to very low, but reached a point where it was just iterating nonstop.
Any help is appreciated!
% Data from 0T.txt
data = readmatrix(‘0T.txt’, ‘HeaderLines’, 1);
T_data = data(:, 1); % First col: Temperature (K)
k_ph_data = data(:, 2); % Second col: kappa_{xx} (W/mK)
% Constants
k_B = 1.380649e-23; % Boltzmann constant in J/K
hbar = 1.0545718e-34; % Reduced Planck constant in J·s
v_s = 4.817e3; % Sound velocity in m/s
theta_D = 235; % Debye temperature in K
L = 1e-6; % Length in m
% Define the integrand function with omega_res1 and omega_res2
integrand = @(omega, T, D, B, A, b, C1, C2, omega_res1, omega_res2) …
(omega.^4 .* exp(hbar*omega./(k_B*T)) ./ (exp(hbar*omega./(k_B*T)) – 1).^2) .* …
(v_s / L + D*omega.^4 + B*omega + A*T*omega.^3 .* exp(-theta_D / (b*T)) + …
C1 * omega.^4 ./ ((omega.^2 – omega_res1.^2).^2 + 1e-10) .* exp(-hbar*omega_res1 / (k_B * T)) ./ …
(1 + exp(-hbar*omega_res1 / (k_B * T))) + …
C2 * omega.^4 ./ ((omega.^2 – omega_res2.^2).^2 + 1e-10) .* exp(-hbar*omega_res2 / (k_B * T)) ./ …
(1 + exp(-hbar*omega_res2 / (k_B * T))));
% Define the k_ph function
k_ph_func = @(params, T) (k_B / (2 * pi^2 * v_s)) * (k_B * T / hbar)^3 .* …
integral(@(omega) integrand(omega, T, params(1), params(2), params(3), params(4), params(5), params(6), params(7), params(8)), 0, theta_D / T);
% Define the function to be minimized
fun = @(params, T) arrayfun(@(t) k_ph_func(params, t), T);
% Initial guess for parameters [D, B, A, b, C1, C2, omega_res1, omega_res2]
initial_guess = [1e-43, 1e-6, 1e-31, 1, 1e9, 1e10, 1e12, 4e12];
% Set bounds
lb = [1e-50, 1e-12, 1e-35, 1, 1e7, 1e8, 1e10, 3e12];
ub = [1e-40, 1e-3, 1e-28, 1000, 1e11, 1e12, 1e14, 5e12];
% Create opts structure
opts = optimoptions(‘lsqcurvefit’, ‘MaxFunctionEvaluations’, 1e4, ‘MaxIterations’, 1e3);
% Use lsqcurvefit for the fitting
[fitted_params, resnorm, residual, exitflag, output] = lsqcurvefit(fun, initial_guess, T_data, k_ph_data, lb, ub, opts);
% Generate fitted curve (using log spacing)
T_fit = logspace(log10(min(T_data)), log10(max(T_data)), 100);
k_ph_fit = fun(fitted_params, T_fit);I am having trouble implementing this equation into the curve fitting toolbox, both in the command and by utilizing the curve fitting GUI.
A little background that may help explain this:
I am wanting to fit experimental data of T(K) vs K_ph (W/m K) which the thermal conductivity of a material, to a model from a journal paper. I have done an okay job in python with scipy.optimize but have been trying MATLAB for a more accurate method.
I have this equation I need to fit
where
A, B, b, C_1, C_2, D, Omega_res1, Omega_res2, and L (ignore L in the exmaple code) are all coefficients I want solved for.
Omega is the independent variable in the integral (omega is solved for) while T is the range 1 to 100 in 1K steps. Or T can simply be my experimental Temperature data as is in my code.
My problems (in the GUI) are in the ways to set the values for T and use an integral in the custom equation box. As in, I am not sure how to tyep the equation in the way MATLAB accepts in the GUI for the toolbox.
My problems for the code is in the integration and lsqcurve fit it seems. I have a lot of warnings/errors such as
Warning: Derivative finite-differencing step was artificially reduced to be within bound constraints. This may
adversely affect convergence. Increasing distance between bound constraints, in dimension 6, to be at least 2e-20
may improve results.
Local minimum possible.
lsqcurvefit stopped because the size of the current step is less than
the value of the step size tolerance.
<stopping criteria details>
Fitted Parameters:
D = 1e-40
B = 1e-20
A = 1e-15
b = 100
C1 = 1e-40
C2 = 1e-40
I am not sure how to fix these, I have gone through other posts on similar matters and have changed the bounds and manually changed the optimoptions values to very low, but reached a point where it was just iterating nonstop.
Any help is appreciated!
% Data from 0T.txt
data = readmatrix(‘0T.txt’, ‘HeaderLines’, 1);
T_data = data(:, 1); % First col: Temperature (K)
k_ph_data = data(:, 2); % Second col: kappa_{xx} (W/mK)
% Constants
k_B = 1.380649e-23; % Boltzmann constant in J/K
hbar = 1.0545718e-34; % Reduced Planck constant in J·s
v_s = 4.817e3; % Sound velocity in m/s
theta_D = 235; % Debye temperature in K
L = 1e-6; % Length in m
% Define the integrand function with omega_res1 and omega_res2
integrand = @(omega, T, D, B, A, b, C1, C2, omega_res1, omega_res2) …
(omega.^4 .* exp(hbar*omega./(k_B*T)) ./ (exp(hbar*omega./(k_B*T)) – 1).^2) .* …
(v_s / L + D*omega.^4 + B*omega + A*T*omega.^3 .* exp(-theta_D / (b*T)) + …
C1 * omega.^4 ./ ((omega.^2 – omega_res1.^2).^2 + 1e-10) .* exp(-hbar*omega_res1 / (k_B * T)) ./ …
(1 + exp(-hbar*omega_res1 / (k_B * T))) + …
C2 * omega.^4 ./ ((omega.^2 – omega_res2.^2).^2 + 1e-10) .* exp(-hbar*omega_res2 / (k_B * T)) ./ …
(1 + exp(-hbar*omega_res2 / (k_B * T))));
% Define the k_ph function
k_ph_func = @(params, T) (k_B / (2 * pi^2 * v_s)) * (k_B * T / hbar)^3 .* …
integral(@(omega) integrand(omega, T, params(1), params(2), params(3), params(4), params(5), params(6), params(7), params(8)), 0, theta_D / T);
% Define the function to be minimized
fun = @(params, T) arrayfun(@(t) k_ph_func(params, t), T);
% Initial guess for parameters [D, B, A, b, C1, C2, omega_res1, omega_res2]
initial_guess = [1e-43, 1e-6, 1e-31, 1, 1e9, 1e10, 1e12, 4e12];
% Set bounds
lb = [1e-50, 1e-12, 1e-35, 1, 1e7, 1e8, 1e10, 3e12];
ub = [1e-40, 1e-3, 1e-28, 1000, 1e11, 1e12, 1e14, 5e12];
% Create opts structure
opts = optimoptions(‘lsqcurvefit’, ‘MaxFunctionEvaluations’, 1e4, ‘MaxIterations’, 1e3);
% Use lsqcurvefit for the fitting
[fitted_params, resnorm, residual, exitflag, output] = lsqcurvefit(fun, initial_guess, T_data, k_ph_data, lb, ub, opts);
% Generate fitted curve (using log spacing)
T_fit = logspace(log10(min(T_data)), log10(max(T_data)), 100);
k_ph_fit = fun(fitted_params, T_fit); I am having trouble implementing this equation into the curve fitting toolbox, both in the command and by utilizing the curve fitting GUI.
A little background that may help explain this:
I am wanting to fit experimental data of T(K) vs K_ph (W/m K) which the thermal conductivity of a material, to a model from a journal paper. I have done an okay job in python with scipy.optimize but have been trying MATLAB for a more accurate method.
I have this equation I need to fit
where
A, B, b, C_1, C_2, D, Omega_res1, Omega_res2, and L (ignore L in the exmaple code) are all coefficients I want solved for.
Omega is the independent variable in the integral (omega is solved for) while T is the range 1 to 100 in 1K steps. Or T can simply be my experimental Temperature data as is in my code.
My problems (in the GUI) are in the ways to set the values for T and use an integral in the custom equation box. As in, I am not sure how to tyep the equation in the way MATLAB accepts in the GUI for the toolbox.
My problems for the code is in the integration and lsqcurve fit it seems. I have a lot of warnings/errors such as
Warning: Derivative finite-differencing step was artificially reduced to be within bound constraints. This may
adversely affect convergence. Increasing distance between bound constraints, in dimension 6, to be at least 2e-20
may improve results.
Local minimum possible.
lsqcurvefit stopped because the size of the current step is less than
the value of the step size tolerance.
<stopping criteria details>
Fitted Parameters:
D = 1e-40
B = 1e-20
A = 1e-15
b = 100
C1 = 1e-40
C2 = 1e-40
I am not sure how to fix these, I have gone through other posts on similar matters and have changed the bounds and manually changed the optimoptions values to very low, but reached a point where it was just iterating nonstop.
Any help is appreciated!
% Data from 0T.txt
data = readmatrix(‘0T.txt’, ‘HeaderLines’, 1);
T_data = data(:, 1); % First col: Temperature (K)
k_ph_data = data(:, 2); % Second col: kappa_{xx} (W/mK)
% Constants
k_B = 1.380649e-23; % Boltzmann constant in J/K
hbar = 1.0545718e-34; % Reduced Planck constant in J·s
v_s = 4.817e3; % Sound velocity in m/s
theta_D = 235; % Debye temperature in K
L = 1e-6; % Length in m
% Define the integrand function with omega_res1 and omega_res2
integrand = @(omega, T, D, B, A, b, C1, C2, omega_res1, omega_res2) …
(omega.^4 .* exp(hbar*omega./(k_B*T)) ./ (exp(hbar*omega./(k_B*T)) – 1).^2) .* …
(v_s / L + D*omega.^4 + B*omega + A*T*omega.^3 .* exp(-theta_D / (b*T)) + …
C1 * omega.^4 ./ ((omega.^2 – omega_res1.^2).^2 + 1e-10) .* exp(-hbar*omega_res1 / (k_B * T)) ./ …
(1 + exp(-hbar*omega_res1 / (k_B * T))) + …
C2 * omega.^4 ./ ((omega.^2 – omega_res2.^2).^2 + 1e-10) .* exp(-hbar*omega_res2 / (k_B * T)) ./ …
(1 + exp(-hbar*omega_res2 / (k_B * T))));
% Define the k_ph function
k_ph_func = @(params, T) (k_B / (2 * pi^2 * v_s)) * (k_B * T / hbar)^3 .* …
integral(@(omega) integrand(omega, T, params(1), params(2), params(3), params(4), params(5), params(6), params(7), params(8)), 0, theta_D / T);
% Define the function to be minimized
fun = @(params, T) arrayfun(@(t) k_ph_func(params, t), T);
% Initial guess for parameters [D, B, A, b, C1, C2, omega_res1, omega_res2]
initial_guess = [1e-43, 1e-6, 1e-31, 1, 1e9, 1e10, 1e12, 4e12];
% Set bounds
lb = [1e-50, 1e-12, 1e-35, 1, 1e7, 1e8, 1e10, 3e12];
ub = [1e-40, 1e-3, 1e-28, 1000, 1e11, 1e12, 1e14, 5e12];
% Create opts structure
opts = optimoptions(‘lsqcurvefit’, ‘MaxFunctionEvaluations’, 1e4, ‘MaxIterations’, 1e3);
% Use lsqcurvefit for the fitting
[fitted_params, resnorm, residual, exitflag, output] = lsqcurvefit(fun, initial_guess, T_data, k_ph_data, lb, ub, opts);
% Generate fitted curve (using log spacing)
T_fit = logspace(log10(min(T_data)), log10(max(T_data)), 100);
k_ph_fit = fun(fitted_params, T_fit); curve fitting MATLAB Answers — New Questions
extract 1 row data of 1 table
I want to extract the data of a row in a table, how to do it
exam: Name address age
hang VN 18
nam vn 40
lan vn 23
I want to retrieve the information of a man named Nam
help me!I want to extract the data of a row in a table, how to do it
exam: Name address age
hang VN 18
nam vn 40
lan vn 23
I want to retrieve the information of a man named Nam
help me! I want to extract the data of a row in a table, how to do it
exam: Name address age
hang VN 18
nam vn 40
lan vn 23
I want to retrieve the information of a man named Nam
help me! extract 1 row data of 1 table MATLAB Answers — New Questions
How do I create windows 10 bootable USB on Mac without bootcamp?
I’m running into a frustrating issue where I need to create a Windows 10 bootable USB for my Macbook Pro 2023, but every attempt to use Boot Camp Assistant has ended in errors. This has left me in a bit of a bind, as I’m keen to find an alternative method that bypasses Boot Camp altogether. The goal is to successfully prepare a USB drive with Windows 10 installation files, which I plan to use on a PC. If anyone knows how to do this directly on macOS, avoiding Boot Camp issues, I’d really appreciate a simplified guide or tool suggestions to get this done.
I’m running into a frustrating issue where I need to create a Windows 10 bootable USB for my Macbook Pro 2023, but every attempt to use Boot Camp Assistant has ended in errors. This has left me in a bit of a bind, as I’m keen to find an alternative method that bypasses Boot Camp altogether. The goal is to successfully prepare a USB drive with Windows 10 installation files, which I plan to use on a PC. If anyone knows how to do this directly on macOS, avoiding Boot Camp issues, I’d really appreciate a simplified guide or tool suggestions to get this done. Read More
Microsoft Gold Partner Perks
Can I get a www.msn.com publishing account if I’m already a Microsoft Gold partner for providing IT & Cloud Services.
My company is www.xavor.com.
Can I get a www.msn.com publishing account if I’m already a Microsoft Gold partner for providing IT & Cloud Services.My company is www.xavor.com. Read More
Sharing: can i hide users / groups from showing on the sharing option
Hello good morning.
I was checking in our SharePoint online sites, and when people want to share things it can be a bit confusing.
at the moment they can see , Individual users, Shared mailboxes, security groups, Microsoft 365 groups, and Mail enabled security groups.
I noticed that when sharing to a group shared mailbox, users still don’t have access to what’s been shared, same with security groups.
Is it possible to hide these so that users don’t get confused?
Thank you
Hello good morning.I was checking in our SharePoint online sites, and when people want to share things it can be a bit confusing.at the moment they can see , Individual users, Shared mailboxes, security groups, Microsoft 365 groups, and Mail enabled security groups. I noticed that when sharing to a group shared mailbox, users still don’t have access to what’s been shared, same with security groups.Is it possible to hide these so that users don’t get confused? Thank you Read More
custom phase changing material does not release heat.
Problem:
When I adjust the latent heat, there’s no change in the temperature curve of the XPS material. I anticipate a stable temperature, ranging between 305K and 320K. So the problem is that the material does not release the absorbed heat.
equations
assert(Cps > 0 && Cpl > 0)
assert(T > 0, ‘Temperature must be greater than absolute zero’)
T == M.T;
if T >= Tmelt_start && T <= Tmelt_end
phaseChangeRate == {0.001, ‘1/s’};
else
phaseChangeRate == {0, ‘1/s’};
end
if phase < 1 && phase > 0
Q == m * Cps * T.der + m * L * phaseChangeRate;
phase.der == phaseChangeRate;
else
Q == m * Cpl * T.der;
phase.der == {0, ‘1/s’};
end
end
explanation of the full code:
This code describes a thermal component that models internal energy storage in a thermal network. Here’s a breakdown of the main parts of this code:
1. **Nodes**: These are points where other components can connect. Two thermal nodes are defined: `M` (top) and `N` (bottom).
2. **Inputs**: These values can be supplied from outside. `Mdot` represents the mass flow rate (in kg/s) and `T_in` is the input temperature (in Kelvin).
3. **Parameters**: These values determine the behavior of the component. They include:
– `mass_type`: Type of mass (constant or variable).
– `mass`: The mass of the thermal component.
– `Cps` and `Cpl`: Specific heat capacity for solid and liquid, respectively.
– `Tmelt_start` and `Tmelt_end`: The temperature range where the material starts melting and stops melting.
– `L`: Specific latent heat.
– `mass_min`: Minimum mass.
– `num_ports`: The number of graphical ports.
4. **Annotations**: These are metadata that provide additional information about the component or dictate how it is displayed in a GUI. Here, it is primarily used to indicate which parameters can be modified externally and to define the component’s icon.
5. **Variables**: These represent the internal states of the component. They include:
– `m`: The mass.
– `T`: The temperature.
– `phase`: The phase (0 for solid, 1 for liquid, and values in between for a mixed phase).
– `phaseChangeRate`: The rate of phase change.
– `Q`: Heat flow rate.
6. **Branches**: These are connections between different parts of the network. Here, the heat flow `Q` from node `M` to another part of the network is defined.
7. **Equations**: These describe the mathematical relationships between the different variables and parameters. They include:
– Relationships between `T`, `Q`, `m`, and other variables, especially around phase change.
– Constraints on certain values (like that `Cps`, `Cpl`, and `T` must be positive).
8. **Connections**: These are the actual connections between the different nodes within the component. Here, node `M` is connected to node `N`.
The essence of this component is that it models a thermal mass that can store and release energy. It also accounts for phase changes, meaning it can melt or solidify within a certain temperature range.
component derdecomponent
% Thermal Mass
% This block models internal energy storage in a thermal network.
nodes
M = foundation.thermal.thermal; % :top
end
inputs(ExternalAccess = none)
Mdot = {0, ‘kg/s’}; % Mdot:bottom
T_in = {300, ‘K’}; % Tin:bottom
end
nodes(ExternalAccess = none)
N = foundation.thermal.thermal; % :bottom
end
parameters
mass_type = foundation.enum.constant_variable.constant; % Mass type
end
parameters (ExternalAccess = none)
mass = {1, ‘kg’}; % Mass
end
parameters
Cps = {200, ‘J/(kg*K)’}; % Specific heat solid
Cpl = {1000, ‘J/(kg*K)’}; % Specific heat liquid
Tmelt_start = {320, ‘K’}; % Start Melting Temperature
Tmelt_end = {305, ‘K’}; % End Melting Temperature
L = {100, ‘J/(kg)’}; % Specific Latent Heat
end
parameters (ExternalAccess = none)
mass_min = {1e-6,’kg’}; % Minimum mass
end
parameters
num_ports = foundation.enum.numPorts2.one; % Number of graphical ports
end
if num_ports == 2
annotations
N : ExternalAccess=modify
end
if mass_type == foundation.enum.constant_variable.constant
annotations
% Icon = ‘mass2.svg’
end
else
annotations
% Icon = ‘mass4.svg’
end
end
else
if mass_type == foundation.enum.constant_variable.variable
annotations
% Icon = ‘mass3.svg’
end
end
end
if mass_type == foundation.enum.constant_variable.constant
annotations
mass : ExternalAccess=modify
end
equations
m == {1,’kg’};
end
else
annotations
[Mdot, T_in, m, mass_min] : ExternalAccess=modify
end
equations
assert(mass_min > 0)
end
end
variables (ExternalAccess=none)
m = {value = {1,’kg’}, priority=priority.high}; % Mass
end
variables
T = {value = {300, ‘K’}, priority = priority.high}; % Temperature
phase = {value = {0, ‘1’}, priority = priority.high}; % Phase
phaseChangeRate = {0, ‘1/s’}; % Rate of phase change
end
variables (Access=private)
Q = {0, ‘W’}; % Heat flow rate
end
branches
Q : M.Q -> *;
end
equations
assert(Cps > 0 && Cpl > 0)
assert(T > 0, ‘Temperature must be greater than absolute zero’)
T == M.T;
if T >= Tmelt_start && T <= Tmelt_end
phaseChangeRate == {0.001, ‘1/s’};
else
phaseChangeRate == {0, ‘1/s’};
end
if phase < 1 && phase > 0
Q == m * Cps * T.der + m * L * phaseChangeRate;
phase.der == phaseChangeRate;
else
Q == m * Cpl * T.der;
phase.der == {0, ‘1/s’};
end
end
connections
connect(M,N)
end
endProblem:
When I adjust the latent heat, there’s no change in the temperature curve of the XPS material. I anticipate a stable temperature, ranging between 305K and 320K. So the problem is that the material does not release the absorbed heat.
equations
assert(Cps > 0 && Cpl > 0)
assert(T > 0, ‘Temperature must be greater than absolute zero’)
T == M.T;
if T >= Tmelt_start && T <= Tmelt_end
phaseChangeRate == {0.001, ‘1/s’};
else
phaseChangeRate == {0, ‘1/s’};
end
if phase < 1 && phase > 0
Q == m * Cps * T.der + m * L * phaseChangeRate;
phase.der == phaseChangeRate;
else
Q == m * Cpl * T.der;
phase.der == {0, ‘1/s’};
end
end
explanation of the full code:
This code describes a thermal component that models internal energy storage in a thermal network. Here’s a breakdown of the main parts of this code:
1. **Nodes**: These are points where other components can connect. Two thermal nodes are defined: `M` (top) and `N` (bottom).
2. **Inputs**: These values can be supplied from outside. `Mdot` represents the mass flow rate (in kg/s) and `T_in` is the input temperature (in Kelvin).
3. **Parameters**: These values determine the behavior of the component. They include:
– `mass_type`: Type of mass (constant or variable).
– `mass`: The mass of the thermal component.
– `Cps` and `Cpl`: Specific heat capacity for solid and liquid, respectively.
– `Tmelt_start` and `Tmelt_end`: The temperature range where the material starts melting and stops melting.
– `L`: Specific latent heat.
– `mass_min`: Minimum mass.
– `num_ports`: The number of graphical ports.
4. **Annotations**: These are metadata that provide additional information about the component or dictate how it is displayed in a GUI. Here, it is primarily used to indicate which parameters can be modified externally and to define the component’s icon.
5. **Variables**: These represent the internal states of the component. They include:
– `m`: The mass.
– `T`: The temperature.
– `phase`: The phase (0 for solid, 1 for liquid, and values in between for a mixed phase).
– `phaseChangeRate`: The rate of phase change.
– `Q`: Heat flow rate.
6. **Branches**: These are connections between different parts of the network. Here, the heat flow `Q` from node `M` to another part of the network is defined.
7. **Equations**: These describe the mathematical relationships between the different variables and parameters. They include:
– Relationships between `T`, `Q`, `m`, and other variables, especially around phase change.
– Constraints on certain values (like that `Cps`, `Cpl`, and `T` must be positive).
8. **Connections**: These are the actual connections between the different nodes within the component. Here, node `M` is connected to node `N`.
The essence of this component is that it models a thermal mass that can store and release energy. It also accounts for phase changes, meaning it can melt or solidify within a certain temperature range.
component derdecomponent
% Thermal Mass
% This block models internal energy storage in a thermal network.
nodes
M = foundation.thermal.thermal; % :top
end
inputs(ExternalAccess = none)
Mdot = {0, ‘kg/s’}; % Mdot:bottom
T_in = {300, ‘K’}; % Tin:bottom
end
nodes(ExternalAccess = none)
N = foundation.thermal.thermal; % :bottom
end
parameters
mass_type = foundation.enum.constant_variable.constant; % Mass type
end
parameters (ExternalAccess = none)
mass = {1, ‘kg’}; % Mass
end
parameters
Cps = {200, ‘J/(kg*K)’}; % Specific heat solid
Cpl = {1000, ‘J/(kg*K)’}; % Specific heat liquid
Tmelt_start = {320, ‘K’}; % Start Melting Temperature
Tmelt_end = {305, ‘K’}; % End Melting Temperature
L = {100, ‘J/(kg)’}; % Specific Latent Heat
end
parameters (ExternalAccess = none)
mass_min = {1e-6,’kg’}; % Minimum mass
end
parameters
num_ports = foundation.enum.numPorts2.one; % Number of graphical ports
end
if num_ports == 2
annotations
N : ExternalAccess=modify
end
if mass_type == foundation.enum.constant_variable.constant
annotations
% Icon = ‘mass2.svg’
end
else
annotations
% Icon = ‘mass4.svg’
end
end
else
if mass_type == foundation.enum.constant_variable.variable
annotations
% Icon = ‘mass3.svg’
end
end
end
if mass_type == foundation.enum.constant_variable.constant
annotations
mass : ExternalAccess=modify
end
equations
m == {1,’kg’};
end
else
annotations
[Mdot, T_in, m, mass_min] : ExternalAccess=modify
end
equations
assert(mass_min > 0)
end
end
variables (ExternalAccess=none)
m = {value = {1,’kg’}, priority=priority.high}; % Mass
end
variables
T = {value = {300, ‘K’}, priority = priority.high}; % Temperature
phase = {value = {0, ‘1’}, priority = priority.high}; % Phase
phaseChangeRate = {0, ‘1/s’}; % Rate of phase change
end
variables (Access=private)
Q = {0, ‘W’}; % Heat flow rate
end
branches
Q : M.Q -> *;
end
equations
assert(Cps > 0 && Cpl > 0)
assert(T > 0, ‘Temperature must be greater than absolute zero’)
T == M.T;
if T >= Tmelt_start && T <= Tmelt_end
phaseChangeRate == {0.001, ‘1/s’};
else
phaseChangeRate == {0, ‘1/s’};
end
if phase < 1 && phase > 0
Q == m * Cps * T.der + m * L * phaseChangeRate;
phase.der == phaseChangeRate;
else
Q == m * Cpl * T.der;
phase.der == {0, ‘1/s’};
end
end
connections
connect(M,N)
end
end Problem:
When I adjust the latent heat, there’s no change in the temperature curve of the XPS material. I anticipate a stable temperature, ranging between 305K and 320K. So the problem is that the material does not release the absorbed heat.
equations
assert(Cps > 0 && Cpl > 0)
assert(T > 0, ‘Temperature must be greater than absolute zero’)
T == M.T;
if T >= Tmelt_start && T <= Tmelt_end
phaseChangeRate == {0.001, ‘1/s’};
else
phaseChangeRate == {0, ‘1/s’};
end
if phase < 1 && phase > 0
Q == m * Cps * T.der + m * L * phaseChangeRate;
phase.der == phaseChangeRate;
else
Q == m * Cpl * T.der;
phase.der == {0, ‘1/s’};
end
end
explanation of the full code:
This code describes a thermal component that models internal energy storage in a thermal network. Here’s a breakdown of the main parts of this code:
1. **Nodes**: These are points where other components can connect. Two thermal nodes are defined: `M` (top) and `N` (bottom).
2. **Inputs**: These values can be supplied from outside. `Mdot` represents the mass flow rate (in kg/s) and `T_in` is the input temperature (in Kelvin).
3. **Parameters**: These values determine the behavior of the component. They include:
– `mass_type`: Type of mass (constant or variable).
– `mass`: The mass of the thermal component.
– `Cps` and `Cpl`: Specific heat capacity for solid and liquid, respectively.
– `Tmelt_start` and `Tmelt_end`: The temperature range where the material starts melting and stops melting.
– `L`: Specific latent heat.
– `mass_min`: Minimum mass.
– `num_ports`: The number of graphical ports.
4. **Annotations**: These are metadata that provide additional information about the component or dictate how it is displayed in a GUI. Here, it is primarily used to indicate which parameters can be modified externally and to define the component’s icon.
5. **Variables**: These represent the internal states of the component. They include:
– `m`: The mass.
– `T`: The temperature.
– `phase`: The phase (0 for solid, 1 for liquid, and values in between for a mixed phase).
– `phaseChangeRate`: The rate of phase change.
– `Q`: Heat flow rate.
6. **Branches**: These are connections between different parts of the network. Here, the heat flow `Q` from node `M` to another part of the network is defined.
7. **Equations**: These describe the mathematical relationships between the different variables and parameters. They include:
– Relationships between `T`, `Q`, `m`, and other variables, especially around phase change.
– Constraints on certain values (like that `Cps`, `Cpl`, and `T` must be positive).
8. **Connections**: These are the actual connections between the different nodes within the component. Here, node `M` is connected to node `N`.
The essence of this component is that it models a thermal mass that can store and release energy. It also accounts for phase changes, meaning it can melt or solidify within a certain temperature range.
component derdecomponent
% Thermal Mass
% This block models internal energy storage in a thermal network.
nodes
M = foundation.thermal.thermal; % :top
end
inputs(ExternalAccess = none)
Mdot = {0, ‘kg/s’}; % Mdot:bottom
T_in = {300, ‘K’}; % Tin:bottom
end
nodes(ExternalAccess = none)
N = foundation.thermal.thermal; % :bottom
end
parameters
mass_type = foundation.enum.constant_variable.constant; % Mass type
end
parameters (ExternalAccess = none)
mass = {1, ‘kg’}; % Mass
end
parameters
Cps = {200, ‘J/(kg*K)’}; % Specific heat solid
Cpl = {1000, ‘J/(kg*K)’}; % Specific heat liquid
Tmelt_start = {320, ‘K’}; % Start Melting Temperature
Tmelt_end = {305, ‘K’}; % End Melting Temperature
L = {100, ‘J/(kg)’}; % Specific Latent Heat
end
parameters (ExternalAccess = none)
mass_min = {1e-6,’kg’}; % Minimum mass
end
parameters
num_ports = foundation.enum.numPorts2.one; % Number of graphical ports
end
if num_ports == 2
annotations
N : ExternalAccess=modify
end
if mass_type == foundation.enum.constant_variable.constant
annotations
% Icon = ‘mass2.svg’
end
else
annotations
% Icon = ‘mass4.svg’
end
end
else
if mass_type == foundation.enum.constant_variable.variable
annotations
% Icon = ‘mass3.svg’
end
end
end
if mass_type == foundation.enum.constant_variable.constant
annotations
mass : ExternalAccess=modify
end
equations
m == {1,’kg’};
end
else
annotations
[Mdot, T_in, m, mass_min] : ExternalAccess=modify
end
equations
assert(mass_min > 0)
end
end
variables (ExternalAccess=none)
m = {value = {1,’kg’}, priority=priority.high}; % Mass
end
variables
T = {value = {300, ‘K’}, priority = priority.high}; % Temperature
phase = {value = {0, ‘1’}, priority = priority.high}; % Phase
phaseChangeRate = {0, ‘1/s’}; % Rate of phase change
end
variables (Access=private)
Q = {0, ‘W’}; % Heat flow rate
end
branches
Q : M.Q -> *;
end
equations
assert(Cps > 0 && Cpl > 0)
assert(T > 0, ‘Temperature must be greater than absolute zero’)
T == M.T;
if T >= Tmelt_start && T <= Tmelt_end
phaseChangeRate == {0.001, ‘1/s’};
else
phaseChangeRate == {0, ‘1/s’};
end
if phase < 1 && phase > 0
Q == m * Cps * T.der + m * L * phaseChangeRate;
phase.der == phaseChangeRate;
else
Q == m * Cpl * T.der;
phase.der == {0, ‘1/s’};
end
end
connections
connect(M,N)
end
end phasechangingmaterial, heattransfer MATLAB Answers — New Questions
Simulink zoom / scroll problem on MacBook Pro trackpad
When I two-finger scroll on my trackpad to zoom a Simulink model, it
zooms in and out rapidly and erratically. Moreoever, pinch-to-zoom
produces no zooming effect.
This problem was noted here:
http://lizard-spock.co.uk/blog/engineering/simulink-scroll-wheel-erratic-behaviour/
They advised disabling scroll-wheel zoom altogether with
File > Simulink Prefs > Editor defaults > Scroll wheel controls zooming preference.
However, the zoom feature is essential for fast model navigation.
I have tried twiddling various settings on the Mac Trackpad system preferences, no luck.
The following Mathworks doc claims that pinch-to-zoom and regular
scroll-zoom should work, but it doesn’t for me.
http://www.mathworks.com/help/simulink/ug/zooming-block-diagrams.html
Has anyone solved this?
("Use a mouse" and "just click the zoom button" are not acceptable
answers, since I don’t want to lug a mouse around just for Matlab and
having to click a button is a crappy UI constraint on something that
should be natural.)
Thanks for your help.When I two-finger scroll on my trackpad to zoom a Simulink model, it
zooms in and out rapidly and erratically. Moreoever, pinch-to-zoom
produces no zooming effect.
This problem was noted here:
http://lizard-spock.co.uk/blog/engineering/simulink-scroll-wheel-erratic-behaviour/
They advised disabling scroll-wheel zoom altogether with
File > Simulink Prefs > Editor defaults > Scroll wheel controls zooming preference.
However, the zoom feature is essential for fast model navigation.
I have tried twiddling various settings on the Mac Trackpad system preferences, no luck.
The following Mathworks doc claims that pinch-to-zoom and regular
scroll-zoom should work, but it doesn’t for me.
http://www.mathworks.com/help/simulink/ug/zooming-block-diagrams.html
Has anyone solved this?
("Use a mouse" and "just click the zoom button" are not acceptable
answers, since I don’t want to lug a mouse around just for Matlab and
having to click a button is a crappy UI constraint on something that
should be natural.)
Thanks for your help. When I two-finger scroll on my trackpad to zoom a Simulink model, it
zooms in and out rapidly and erratically. Moreoever, pinch-to-zoom
produces no zooming effect.
This problem was noted here:
http://lizard-spock.co.uk/blog/engineering/simulink-scroll-wheel-erratic-behaviour/
They advised disabling scroll-wheel zoom altogether with
File > Simulink Prefs > Editor defaults > Scroll wheel controls zooming preference.
However, the zoom feature is essential for fast model navigation.
I have tried twiddling various settings on the Mac Trackpad system preferences, no luck.
The following Mathworks doc claims that pinch-to-zoom and regular
scroll-zoom should work, but it doesn’t for me.
http://www.mathworks.com/help/simulink/ug/zooming-block-diagrams.html
Has anyone solved this?
("Use a mouse" and "just click the zoom button" are not acceptable
answers, since I don’t want to lug a mouse around just for Matlab and
having to click a button is a crappy UI constraint on something that
should be natural.)
Thanks for your help. simulink, trackpad, zoom MATLAB Answers — New Questions
Compiling error : Unknown file extension ‘ ‘
I am compiling a file that contains a caller block, and that c caller block is calling c file that have many header files included. But while compiling its giving error Unknown "file extension ‘ ‘ ". Can anyone tell me how to solve this one?I am compiling a file that contains a caller block, and that c caller block is calling c file that have many header files included. But while compiling its giving error Unknown "file extension ‘ ‘ ". Can anyone tell me how to solve this one? I am compiling a file that contains a caller block, and that c caller block is calling c file that have many header files included. But while compiling its giving error Unknown "file extension ‘ ‘ ". Can anyone tell me how to solve this one? c caller, mex, error, unknown file MATLAB Answers — New Questions
Unexpected Display Name Changes in Outlook Contact Cards After NetIQ IAM Upgrade Integrated with AD
Description of Issue: After performing an upgrade on our NetIQ Identity and Access Management system, which is integrated with our Active Directory, we’ve encountered an issue in Outlook/Exchange:
When right-clicking a recipient in the ‘To’ field and selecting “Open Contact Card”, the contact card initially displays correctly. However, after fully loading, the display name changes to an unexpected format: “[username] managed by [owner]”.
Background Information:
NetIQ’s Role: NetIQ manages our IAM and synchronizes user information with Active Directory.Service Account Configuration:First Name: Set to the service account’s username/user ID.Last Name: Set to “Managed by [owner name]”.Email Address: Both the service account and the owner share the same email address.Recent Changes: Completed a full upgrade of NetIQ components (IDM, IG, SSPR, Reporting, RemoteLoader, Designer) last week.
Troubleshooting Steps Taken:
Cleared Outlook cache.Redownloaded the address book.Verified configurations in Active Directory.
Request for Assistance:
Has anyone experienced similar issues where display names in Outlook are affected by changes in Active Directory attributes?Could this be related to how Outlook/Exchange interprets certain AD attributes post-update?Are there recommended steps to troubleshoot or resolve display name discrepancies caused by backend IAM system updates?
Description of Issue: After performing an upgrade on our NetIQ Identity and Access Management system, which is integrated with our Active Directory, we’ve encountered an issue in Outlook/Exchange:When right-clicking a recipient in the ‘To’ field and selecting “Open Contact Card”, the contact card initially displays correctly. However, after fully loading, the display name changes to an unexpected format: “[username] managed by [owner]”.Background Information:NetIQ’s Role: NetIQ manages our IAM and synchronizes user information with Active Directory.Service Account Configuration:First Name: Set to the service account’s username/user ID.Last Name: Set to “Managed by [owner name]”.Email Address: Both the service account and the owner share the same email address.Recent Changes: Completed a full upgrade of NetIQ components (IDM, IG, SSPR, Reporting, RemoteLoader, Designer) last week. Troubleshooting Steps Taken:Cleared Outlook cache.Redownloaded the address book.Verified configurations in Active Directory.Request for Assistance:Has anyone experienced similar issues where display names in Outlook are affected by changes in Active Directory attributes?Could this be related to how Outlook/Exchange interprets certain AD attributes post-update?Are there recommended steps to troubleshoot or resolve display name discrepancies caused by backend IAM system updates? Read More
How can I send an email from my Exchange Server to Microsoft Exchange Online
Hi,
I have a requirement to route secure SMTP messages through my On-Premise Exchange Server to Exchange Online.
What is the best way to do this?
The Server was setup with a Send Connector to Exchange Online but I am not entirely sure about the process.
Will I need to create a receive connector for secure smtp and point the apps and devices to sent to it?
Will I have to get them to use an account that exists in Exchange Online to authenticate?
What is the best way to do this?
Thanks
Hi, I have a requirement to route secure SMTP messages through my On-Premise Exchange Server to Exchange Online. What is the best way to do this? The Server was setup with a Send Connector to Exchange Online but I am not entirely sure about the process. Will I need to create a receive connector for secure smtp and point the apps and devices to sent to it? Will I have to get them to use an account that exists in Exchange Online to authenticate? What is the best way to do this? Thanks Read More
Why not separate the Defender for Cloud roles from Azure resources RBAC roles
I am wondering why MS can’t separate the Defender for Cloud roles from the Azure resources RBAC roles, similar to the separation implemented for Reservations and Cost Management + Billing?
Our Azure landing zone operates as a self-service solution, where subscription owners also serve as resource administrators within their specific subscriptions.
Consequently, I have encountered difficulties enforcing certain security features provided through the Defender for Cloud. Each time these features are enabled, some subscription administrators proceed to disable them.
I am wondering why MS can’t separate the Defender for Cloud roles from the Azure resources RBAC roles, similar to the separation implemented for Reservations and Cost Management + Billing? Our Azure landing zone operates as a self-service solution, where subscription owners also serve as resource administrators within their specific subscriptions. Consequently, I have encountered difficulties enforcing certain security features provided through the Defender for Cloud. Each time these features are enabled, some subscription administrators proceed to disable them. Read More
How Can I Download Playlist from Spotify to Computer on Windows 10?
I have an active Spotify Premium account but the downloaded music from Spotify is in OGG format, which is not compatible with many devices and media players. This limitation has been quite frustrating as it restricts my ability to enjoy my Spotify playlist on different devices such as my Windows 10 laptop and car.
My question is how to download playlist from Spotify to my Windows 10 computer to MP3 so I can play them on my PC and my car. If you have used any such tools, please share your insights on their features, user friendliness, and overall effectiveness. Your feedback will be invaluable in helping me and others find the best solution for enjoying Spotify music seamlessly across multiple devices.
Thank you
I have an active Spotify Premium account but the downloaded music from Spotify is in OGG format, which is not compatible with many devices and media players. This limitation has been quite frustrating as it restricts my ability to enjoy my Spotify playlist on different devices such as my Windows 10 laptop and car. My question is how to download playlist from Spotify to my Windows 10 computer to MP3 so I can play them on my PC and my car. If you have used any such tools, please share your insights on their features, user friendliness, and overall effectiveness. Your feedback will be invaluable in helping me and others find the best solution for enjoying Spotify music seamlessly across multiple devices. Thank you Read More
LangChain.js + Azure: A Generative AI App Journey
Microsoft recently organized an event dedicated to JavaScript developers, the Azure Developers JavaScript Day 2024. The event featured various technical and practical sessions, including a session on the use of LangChain.js, a framework for developing applications based on language models. In this article, we’re going to explore the talk given by Yohan Larsorsa, who is a Senior Developer Advocate with Microsoft’s JavaScript + A.I Advocacy team!
What was covered during the session?
Introducing LangChain.js: A Bridge to Generative AI
At the heart of this session lies LangChain.js, a JavaScript library designed to work with large language models. A sister project to the Python-based LangChain, it has garnered acclaim within the AI community for its high-level abstractions that simplify the complexities of working with models, vector databases, agents, and utilities. Yohan emphasized the significance of LangChain.js in providing a seamless transition from local prototyping to cloud-based deployment, underpinning the session’s focus on rapid experimentation and scalability.
A Practical Demonstration: Simplifying Video Content Queries
The session embarked on a practical journey to address a common dilemma: accessing information in video content without watching the entire video. Yohan introduced a concept using the Retrieval-Augmented Generation (RAG) approach, which combines a retriever component for searching within a knowledge base and a generator component for crafting answers. This approach not only streamlines the process of extracting relevant information from videos but also ensures the accuracy and relevance of generated content.
Project link: Ask YouTube: LangChain.js + Azure Quickstart
From Prototype to Production: A Step-by-Step Guide About the Project
Yohan’s demonstration provided a comprehensive walkthrough, starting from creating a local prototype using LangChain.js and Ollama. Ollama is an open-source tool that allows you to run and create large language models locally. It supports various models, such as Llama 2 and Code Llama, and can be used to run Machine Learning models on Kubernetes. It supports models of different sizes and is compatible with OpenAI’s Chat Completions API.
The process included downloading transcripts from YouTube videos, chunking texts for manageability, and transforming text into vector representations for inclusion in a vector database.
As the session progressed, Yohan showcased the transition to a production-ready application leveraging Azure components. This shift involved replacing local models and databases with Azure OpenAI services and Azure AI Search, demonstrating how minimal changes in the code could adapt the prototype for production use without sacrificing functionality or performance.
The Impact of LangChain.js and Azure on GenAI App Development
The session concluded with reflections on the transformative potential of LangChain.js and Azure in the development of GenAI applications. By enabling developers to experiment locally and scale globally, these tools offer a robust framework for innovating at the speed of thought. The session not only demystified the process of integrating GenAI into app development but also illuminated the path for developers seeking to explore the frontier of AI-driven applications.
Looking Forward
As developers continue to explore the vast landscape of Generative AI, tools like LangChain.js and Azure stand out as beacons of innovation, offering a blend of flexibility, scalability, and efficiency. Yohan’s session at the JavaScript Dev Day not only provided a practical guide to leveraging these tools but also inspired a vision of the future where GenAI applications become an integral part of our digital experience. Especially for those who are JavaScript developers, the journey through LangChain.js and Azure offers a glimpse into the transformative power of Generative AI, beckoning developers to embark on a journey of discovery and innovation.
In the spirit of continuous learning and exploration, Yohan encouraged the audience to dive deeper into the resources provided, including the source code for the demonstration and further educational materials on RAG. As we stand on the brink of a new era in app development, the journey through LangChain.js and Azure offers a glimpse into the transformative power of Generative AI, beckoning developers to embark on a journey of discovery and innovation.
Conclusion
By bridging the gap between local prototyping and cloud deployment, LangChain.js and Azure empower developers to explore the frontiers of Generative AI with ease and efficiency. Yohan’s practical demonstration and step-by-step guide illuminated the path for developers seeking to integrate GenAI into their applications, offering a glimpse into the transformative potential of these tools. As we look ahead to a future shaped by AI-driven innovation, the journey through LangChain.js and Azure serves as an invitation to developers to embark on a journey of discovery and creation in the realm of Generative AI.
Additional Resources
Learn Collection
LangChain.js Documentation
Generative A.I for Beginners
Repository: ChatGPT + Enterprise data with Azure OpenAI and Azure AI Search
Contoso Real Estate Enterprise Project
Stay Tuned for More Insights
If you wish, you can follow what happened during the two days of the event via the playlist on YouTube.
Microsoft Tech Community – Latest Blogs –Read More
Looking to License two separate Programs PolySpace on one port and Matlab on a separate one.
I have licensing in an offline environment. One for Matlab and one for POLLSPACE. I’m looking to license them both on the same server (since both licenses have that MAC:ID tied to them). I’m running into the fact that I can’t run two separate MLM.exe’s on the same FLEXNet license manager. So my thought was I could combine the licensing that is for the same server ID, for the two products. But I seem to be running into and issue that I don’t know how to make it so both products are working and on separate ports.
Is there a way either in options file or something similar to be able to take two valid licenses and have the products be listening on two separate ports?
Thanks!I have licensing in an offline environment. One for Matlab and one for POLLSPACE. I’m looking to license them both on the same server (since both licenses have that MAC:ID tied to them). I’m running into the fact that I can’t run two separate MLM.exe’s on the same FLEXNet license manager. So my thought was I could combine the licensing that is for the same server ID, for the two products. But I seem to be running into and issue that I don’t know how to make it so both products are working and on separate ports.
Is there a way either in options file or something similar to be able to take two valid licenses and have the products be listening on two separate ports?
Thanks! I have licensing in an offline environment. One for Matlab and one for POLLSPACE. I’m looking to license them both on the same server (since both licenses have that MAC:ID tied to them). I’m running into the fact that I can’t run two separate MLM.exe’s on the same FLEXNet license manager. So my thought was I could combine the licensing that is for the same server ID, for the two products. But I seem to be running into and issue that I don’t know how to make it so both products are working and on separate ports.
Is there a way either in options file or something similar to be able to take two valid licenses and have the products be listening on two separate ports?
Thanks! license, licensemanager MATLAB Answers — New Questions
MS Project Planner TImeline
Is there is a way to view the MS Project Planner timeline view in SharePoint site. Currently the planner web part only shows the basic planner plans. It is not even showing the plan that was created on Project Planner(premium license) MS Project Plan 1 or MS Planner Plan 1.
Is there is a way to view the MS Project Planner timeline view in SharePoint site. Currently the planner web part only shows the basic planner plans. It is not even showing the plan that was created on Project Planner(premium license) MS Project Plan 1 or MS Planner Plan 1. Read More
Optimise XLOOKUP Formula for quicker updates
Hello all, I have been revamping a spreadsheet recently and have worked up a solution using an XLOOKUP formula however the Calculation response is about 30s. I believe it would work better on a stronger computer however that’s not likely to change so thus I need to look at the formula.
Background – Formula was previously a VLOOKUP searching within date ranges but would find the earliest entry and carry it over instead which lead to data not showing in particular date ranges a
=XLOOKUP(1,(Baled!A:A=’Isis Report Conversion’!A3)*(Baled!I:I>=’Isis Report Conversion’!$B$1)*(Baled!I:I<=’Isis Report Conversion’!$D$1),Baled!I:I)
I have the formula checking for entries on a separate sheet within a certain date range set by
(see highlighted below)
=XLOOKUP(1,(Baled!A:A=’Isis Report Conversion’!A3)*(Baled!I:I>=’Isis Report Conversion’!$B$1)*(Baled!I:I<=’Isis Report Conversion’!$D$1),Baled!I:I)
I have this formula or specific variations of it looking for different values under 4 Headers for a total of 134 Rows – Am I asking to much of the hardware I have access to or is this formula able to be optimised? Happy to try any variations or idea’s as this sheet is not currently in production.
Hello all, I have been revamping a spreadsheet recently and have worked up a solution using an XLOOKUP formula however the Calculation response is about 30s. I believe it would work better on a stronger computer however that’s not likely to change so thus I need to look at the formula.Background – Formula was previously a VLOOKUP searching within date ranges but would find the earliest entry and carry it over instead which lead to data not showing in particular date ranges a =XLOOKUP(1,(Baled!A:A=’Isis Report Conversion’!A3)*(Baled!I:I>=’Isis Report Conversion’!$B$1)*(Baled!I:I<=’Isis Report Conversion’!$D$1),Baled!I:I) I have the formula checking for entries on a separate sheet within a certain date range set by (see highlighted below)=XLOOKUP(1,(Baled!A:A=’Isis Report Conversion’!A3)*(Baled!I:I>=’Isis Report Conversion’!$B$1)*(Baled!I:I<=’Isis Report Conversion’!$D$1),Baled!I:I) I have this formula or specific variations of it looking for different values under 4 Headers for a total of 134 Rows – Am I asking to much of the hardware I have access to or is this formula able to be optimised? Happy to try any variations or idea’s as this sheet is not currently in production. Read More
Finding mean value over certain amount of values in a matrix
Hello!
I would like to calculate the mean value of a defined number of values of the columns in a matrix.
e.g.
Mean value every 2 values column by column of A.
A = [1,2,3;4,6,8;7,12,7;14,4,23];
result = [2.5,4,5.5;10.5,8,15]
Thanks for the answers in advance.Hello!
I would like to calculate the mean value of a defined number of values of the columns in a matrix.
e.g.
Mean value every 2 values column by column of A.
A = [1,2,3;4,6,8;7,12,7;14,4,23];
result = [2.5,4,5.5;10.5,8,15]
Thanks for the answers in advance. Hello!
I would like to calculate the mean value of a defined number of values of the columns in a matrix.
e.g.
Mean value every 2 values column by column of A.
A = [1,2,3;4,6,8;7,12,7;14,4,23];
result = [2.5,4,5.5;10.5,8,15]
Thanks for the answers in advance. mean, matlab, reshape MATLAB Answers — New Questions
How to deal with MISRA SLSF 036 rule
Hello,
I’m using Simulink and Stateflow to produce a MISRA SLSF and MISRA C compliant model, to produce an AUTOSAR SwC with Embedded Coder.
I’m using bus signals into models in different points as they are really useful for my intended implementation.
One of the required rules by MISRA SLSF is the 036. The statement "A" of this rule suggest not to use Bus inputs with Stateflow, since buses are used in Simulink to package signals together often with different types. Each data in Stateflow must have a unique type definition.
My questions are:
– Is this rule still valid with R2018a?
– Is there a correlated check into Model Advisor for this rule?
– Is there a way to use buses and respect this rule?
Thanks in advanceHello,
I’m using Simulink and Stateflow to produce a MISRA SLSF and MISRA C compliant model, to produce an AUTOSAR SwC with Embedded Coder.
I’m using bus signals into models in different points as they are really useful for my intended implementation.
One of the required rules by MISRA SLSF is the 036. The statement "A" of this rule suggest not to use Bus inputs with Stateflow, since buses are used in Simulink to package signals together often with different types. Each data in Stateflow must have a unique type definition.
My questions are:
– Is this rule still valid with R2018a?
– Is there a correlated check into Model Advisor for this rule?
– Is there a way to use buses and respect this rule?
Thanks in advance Hello,
I’m using Simulink and Stateflow to produce a MISRA SLSF and MISRA C compliant model, to produce an AUTOSAR SwC with Embedded Coder.
I’m using bus signals into models in different points as they are really useful for my intended implementation.
One of the required rules by MISRA SLSF is the 036. The statement "A" of this rule suggest not to use Bus inputs with Stateflow, since buses are used in Simulink to package signals together often with different types. Each data in Stateflow must have a unique type definition.
My questions are:
– Is this rule still valid with R2018a?
– Is there a correlated check into Model Advisor for this rule?
– Is there a way to use buses and respect this rule?
Thanks in advance stateflow, misra MATLAB Answers — New Questions