Category: Matlab
Category Archives: Matlab
How to improve the loading performance of a large app?
I have a custom app, which is growing continuously, and has become quite large. Thus, the AppDesigner takes a long time to open this app.I have a custom app, which is growing continuously, and has become quite large. Thus, the AppDesigner takes a long time to open this app. I have a custom app, which is growing continuously, and has become quite large. Thus, the AppDesigner takes a long time to open this app. MATLAB Answers — New Questions
Just downloaded MATLAB 2025a: Workspace is blank and greyed out
I just downloaded MATLAB 2025a and no variables show up in the Workspace, even though they are actually saved in memory. For example, if I just open MATLAB and type x = 1, nothing happens. But when I type x, then MATLAB returns the value stored as 1. Nothing appears in the workspace, no named variables, variable types, the size or class, etc. If I right click on the Workspace and try to make a new variable, nothing happens. The "Save Workspace" and "Clear Workspace" are greyed out. Clicking "Refresh" also doesn’t do anything. See the attached screenshot.
I have tried digging into the MATLAB preferences to see what I am missing, but can’t find anything.
Note that I am running a 2024 MacBook Pro Sequoia 15.5.I just downloaded MATLAB 2025a and no variables show up in the Workspace, even though they are actually saved in memory. For example, if I just open MATLAB and type x = 1, nothing happens. But when I type x, then MATLAB returns the value stored as 1. Nothing appears in the workspace, no named variables, variable types, the size or class, etc. If I right click on the Workspace and try to make a new variable, nothing happens. The "Save Workspace" and "Clear Workspace" are greyed out. Clicking "Refresh" also doesn’t do anything. See the attached screenshot.
I have tried digging into the MATLAB preferences to see what I am missing, but can’t find anything.
Note that I am running a 2024 MacBook Pro Sequoia 15.5. I just downloaded MATLAB 2025a and no variables show up in the Workspace, even though they are actually saved in memory. For example, if I just open MATLAB and type x = 1, nothing happens. But when I type x, then MATLAB returns the value stored as 1. Nothing appears in the workspace, no named variables, variable types, the size or class, etc. If I right click on the Workspace and try to make a new variable, nothing happens. The "Save Workspace" and "Clear Workspace" are greyed out. Clicking "Refresh" also doesn’t do anything. See the attached screenshot.
I have tried digging into the MATLAB preferences to see what I am missing, but can’t find anything.
Note that I am running a 2024 MacBook Pro Sequoia 15.5. workspace, variable, variables, mac MATLAB Answers — New Questions
The detectImportOptions not able to recognize and use 2nd row of a file as column name
filename = ‘data.csv’;
opts = detectImportOptions(filename);
% Adjust options to use the second row as headers
opts.DataLines = [3 Inf]; % Start reading data from the third row
opts.VariableNamesLine = 2; % Use the second row for column names
% Read the table
dataTable = readtable(filename, opts);
The above code is not able to return a data table with the columns names same as the names mention in second row of the file, Instead it renames the columns in datatable as Var1, Var2, Var3 and Var4 instead of second, volt, volt and Ampere.filename = ‘data.csv’;
opts = detectImportOptions(filename);
% Adjust options to use the second row as headers
opts.DataLines = [3 Inf]; % Start reading data from the third row
opts.VariableNamesLine = 2; % Use the second row for column names
% Read the table
dataTable = readtable(filename, opts);
The above code is not able to return a data table with the columns names same as the names mention in second row of the file, Instead it renames the columns in datatable as Var1, Var2, Var3 and Var4 instead of second, volt, volt and Ampere. filename = ‘data.csv’;
opts = detectImportOptions(filename);
% Adjust options to use the second row as headers
opts.DataLines = [3 Inf]; % Start reading data from the third row
opts.VariableNamesLine = 2; % Use the second row for column names
% Read the table
dataTable = readtable(filename, opts);
The above code is not able to return a data table with the columns names same as the names mention in second row of the file, Instead it renames the columns in datatable as Var1, Var2, Var3 and Var4 instead of second, volt, volt and Ampere. detectimportoptions, readtable MATLAB Answers — New Questions
Building a continuous-time state-space model for the heat equation
Hello,
I’m struggeling a litle bit with a thermal model based on the two and thre dimensional heat equation.
My aim is to estimate the HCT with the aid of "experimental data" and a grey-box model.
The thermal BC’s are quite simple, and illustrated below.
I generate dummy data via this matalb script:
% generate_dummy_tempdata_and_model_fixed.m
% Generate Dummy-data and prepare (2D/3D)
clc, close all, clear all
%% === Parameter ===
modellTyp = "3D"; % "2D" or "3D"
nx = 4; ny = 4; nz = 4; % Node count
dx = 0.02;dy = 0.03; dz = 0.04; % Node distance [m]
times = 0:1:30; % Time range [s]
T0 = 300; % Initial temperature [K]
dt = times(2) – times(1); % Time step [s]
%% === 1) Generate dummy-data and save as CSV ===
data = [];
switch modellTyp
case "2D"
for iy = 0:ny-1
for ix = 0:nx-1
x = ix * dx;
y = iy * dy;
Tcurve = T0 + 10 * sin(2*pi*times/60 + ix*0.3 + iy*0.5);
data = [data; x, y, Tcurve];
end
end
% Header ass string array
header = ["x","y", "t" + string(times)];
csvFile = ‘example_tempdata2D.csv’;
case "3D"
for iz = 0:nz-1
for iy = 0:ny-1
for ix = 0:nx-1
x = ix * dx;
y = iy * dy;
z = iz * dz;
Tcurve = T0 + 10 * sin(2*pi*times/60 + ix*0.2 + iy*0.3 + iz*0.4);
data = [data; x, y, z, Tcurve];
end
end
end
% Header as string array
header = ["x","y","z", "t" + string(times)];
csvFile = ‘example_tempdata3D.csv’;
end
% Bulid table and save
Ttbl_out = array2table(data, ‘VariableNames’, header);
writetable(Ttbl_out, csvFile);
disp([‘Dummy-data saved: ‘, csvFile]);
The core of the simulation is the transformation of the 2d and 3d diffusion equation into an ode.
I do it with this script:
function [A,B,C,D] = fHeat2D3D(theta, Ts)
% fHeat2D3D Continuous-time grey-box state-space for 2D/3D heat diffusion
% Signature for idgrey: fHeat2D3D(theta, Ts)
% Inputs:
% theta = [Lambda, rho, cp, hBot1, …, hBotN]
% Ts = sample time (ignored in continuous-time model)
% Globals: nx, ny, nz, dx, dy, dz, modellTyp, h_top
global nx ny nz dx dy dz modellTyp h_top
% Extract physical parameters
Lambda = theta(1);
rho = theta(2);
cp = theta(3);
% Determine expected number of bottom convection coefficients
if strcmp(modellTyp,’2D’)
expectedNbot = nx;
else
expectedNbot = nx * nz;
end
% Validate theta length
if length(theta) ~= 3 + expectedNbot
error(‘Theta must have length 3+%d (got %d)’, expectedNbot, length(theta));
end
% Extract bottom convection coefficients
hBot = theta(4:end);
% Number of states
if strcmp(modellTyp,’2D’)
N = nx * ny;
else
N = nx * ny * nz;
end
% Build A matrix (2D/3D Laplacian)
A = zeros(N);
dists = [dx, dx, dy, dy];
for idx = 1:N
tmp = idx – 1;
ix = mod(tmp, nx) + 1;
iy = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
iz = 1;
else
iz = floor(tmp / (nx * ny)) + 1;
end
diagSum = 0;
nbr = [-1,0; 1,0; 0,-1; 0,1];
for k = 1:4
x2 = ix + nbr(k,1);
y2 = iy + nbr(k,2);
if x2>=1 && x2<=nx && y2>=1 && y2<=ny
z2 = iz;
idx2 = x2 + (y2-1)*nx + (z2-1)*nx*ny;
K = Lambda / (rho * cp * dists(k)^2);
A(idx, idx2) = K;
diagSum = diagSum + K;
end
end
A(idx, idx) = -diagSum;
end
% Build B matrix
% Identify side (Dirichlet) nodes
side = false(N,1);
for idx = 1:N
tmp = idx – 1;
x = mod(tmp, nx) + 1;
y = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
side(idx) = (x == 1) || (x == nx);
else
z = floor(tmp / (nx * ny)) + 1;
side(idx) = (x==1)||(x==nx)||(y==1)||(y==ny);
end
end
Nside = sum(side);
B = zeros(N, Nside + 1 + expectedNbot);
% Side BC inputs
sidx = find(side);
for i = 1:Nside
B(sidx(i), i) = 1;
end
% Top convection BC
if strcmp(modellTyp,’2D’)
topIdx = find(~side & floor((0:N-1)/nx)==0);
else
topIdx = find(~side & floor((0:N-1)/(nx*ny))==nz-1);
end
for i = 1:numel(topIdx)
B(topIdx(i), Nside+1) = h_top;
end
% Bottom convection BC
if strcmp(modellTyp,’2D’)
botIdx = find(~side & floor((0:N-1)/nx)==ny-1);
else
botIdx = find(~side & floor((0:N-1)/(nx*ny))==0);
end
for i = 1:numel(botIdx)
B(botIdx(i), Nside+1+i) = hBot(i);
end
% Outputs and feedthrough
C = eye(N);
D = zeros(N, size(B,2));
end
Finally the ode ("function [A,B,C,D] = fHeat2D3D(theta, Ts)") is used as continuous-time state-space model to estimate the system parameter HTC(bottom), heat conductivity, density and specific heat capacity via idgrey and greyest.
% greybox_heat_diffusion.m
% Parametric continuous-time grey-box model for 2D/3D heat conduction
clear; clc; close all;
global nx ny nz dx dy dz modellTyp h_top t_env_top
%% === User setup ===
modellTyp = "2D"; % "2D" or "3D"
nx = 3; ny = 3; nz = 3; % Count of nodes in x, y, z direction(ignore nz for 2D)
dx = 0.02; dy = 0.03; dz = 0.04; % Distance between nodes [m]
dt = 1; % Time step [s]
times = 0:dt:60; % Time range [s]
csv2D = ‘example_tempdata2D.csv’;
csv3D = ‘example_tempdata3D.csv’;
% Fixed values / Top-HTC
t_env_top = 293; % Ambient free stream temperature [K]
h_top = 10; % HTC at the top edge [W/(m^2*K)]
%% === Initial guess of the model parameter ===
theta0.Lambda = 50; % Heat conduction [W/(m*K)]
theta0.rho = 7800;% Density [kg/m^3]
theta0.cp = 460; % Heat capacity [J/(kg*K)]
if modellTyp=="2D"
h_bot0 = 20*ones(nx,1);
else
h_bot0 = 20*ones(nx*nz,1);
end
%% === Read experimental data ===
if modellTyp=="2D"
Tdata = readtable(csv2D);
Texp = Tdata{:,3:end};
Nstates = nx*ny;
else
Tdata = readtable(csv3D);
Texp = Tdata{:,4:end};
Nstates = nx*ny*nz;
end
Nmeas = size(Texp,2);
%% === Calculate side indices ===
sideNodes = false(Nstates,1);
for idx=1:Nstates
tmp=idx-1; ix=mod(tmp,nx)+1; iy=floor(tmp/nx)+1;
if strcmp(modellTyp,"2D")
sideNodes(idx) = ix==1 || ix==nx;
else
iz=floor(tmp/(nx*ny))+1;
sideNodes(idx) = ix==1||ix==nx||iy==1||iy==ny;
end
end
sideIdx = find(sideNodes);
%% === Build input-matrix u ===
T_sideBC = Texp(sideIdx,:); % Side nodes – BC (experimental value)
T_topBC = t_env_top * ones(1,Nmeas);
u = [T_sideBC’ T_topBC’ zeros(Nmeas,length(h_bot0))];
%% === idgrey Setup ===
param0 = [theta0.Lambda theta0.rho theta0.cp h_bot0′];
order = [Nstates Nstates Nstates 0];
[A,B,C,D] = fHeat2D3D(param0, dt);
sysi = idgrey(‘fHeat2D3D’, param0, ‘c’, order, …
‘InputName’,[repmat({‘T_sideBC’},1,length(sideIdx)) {‘T_top’} repmat({‘T_bot’},1,length(h_bot0))], …
‘OutputName’, repmat({‘Tnode’},1,Nstates));
% Release parameters (all)
sysi.Structure.Parameters.Free = true;
%% === Parameter-estimation ===
data_id = iddata(Texp’, u, dt);
opt = greyestOptions(‘Display’,’on’,’InitialCondition’,’zero’);
sys_est = greyest(data_id, sysi, opt);
%% === Extract estimated values ===
th = sys_est.Structure.Parameters;
Lambda_est = th(1).Value; rho_est = th(2).Value; cp_est = th(3).Value;
hBot_est = [th(4:end).Value]’;
%% === Plots ===
Tsim = sim(sys_est, data_id);
% Plot h_bot
figure;
if strcmp(modellTyp,"2D")
plot(unique(Tdata.x), hBot_est, ‘o-‘, ‘LineWidth’, 2);
xlabel(‘x [m]’); ylabel(‘h_{bot} [W/m^2K]’);
title(‘HTC at the bottom edge (2D)’); grid on;
else
% 3D-Surface plot of h_bot at bottom surface
[Xq, Zq] = meshgrid(unique(Tdata.x), unique(Tdata.z));
hq = griddata(Tdata.x, Tdata.z, hBot_est, Xq, Zq, ‘natural’);
surf(Xq, Zq, hq);
xlabel(‘x [m]’); ylabel(‘z [m]’); zlabel(‘h_{bot} [W/m^2K]’);
title(‘HTC at bottom surface (3D)’); colorbar;
shading interp; view(30, 30);
end
% Comparison temperature-simulation vs. temperature-measurement
figure;
Nrow = ceil(sqrt(Nstates));
for i = 1:Nstates
subplot(Nrow, Nrow, i);
plot(times, Texp(i,:), ‘-‘, ‘LineWidth’, 1.5); hold on;
plot(times, Tsim.y(i,:), ‘:’, ‘LineWidth’, 1.5);
title(sprintf(‘Nodes %d’, i));
xlabel(‘Time [s]’); ylabel(‘T [°C]’);
legend(‘Experiment’, ‘Simulation’);
grid on;
end
% 3D-Point: final temperature distribution
if strcmp(modellTyp,"3D")
figure;
scatter3(Tdata.x, Tdata.y, Tdata.z, 50, Tsim.y(:,end), ‘filled’);
xlabel(‘x’); ylabel(‘y’); zlabel(‘z’);
title(‘Simulated temperature distribution at t=tend’);
colorbar; view(30,30);
end
%% End of the script
The call of the script "greybox_heat_diffusion.m" is not working properly and the function "fHeat2D3D" is not called correct.
For the averaging of the corne nodes (2D) respectively the corner & edge nodes (3D). I made this script:
function [A,B,C,D] = fHeat2D3D(theta, Ts)
% fHeat2D3D Continuous-time grey-box state-space for 2D/3D heat diffusion
% Signature for idgrey: fHeat2D3D(theta, Ts)
% Inputs:
% theta = [Lambda, rho, cp, hBot1, …, hBotN]
% Ts = sample time (ignored in continuous-time model)
% Globals: nx, ny, nz, dx, dy, dz, modellTyp, h_top
global nx ny nz dx dy dz modellTyp h_top
% Extract physical parameters
Lambda = theta(1);
rho = theta(2);
cp = theta(3);
% Determine expected number of bottom convection coefficients
if strcmp(modellTyp,’2D’)
expectedNbot = nx;
else
expectedNbot = nx * nz;
end
% Validate theta length
if length(theta) ~= 3 + expectedNbot
error(‘Theta must have length 3+%d (got %d)’, expectedNbot, length(theta));
end
% Extract bottom convection coefficients
hBot = theta(4:end);
% Number of states
if strcmp(modellTyp,’2D’)
N = nx * ny;
else
N = nx * ny * nz;
end
% Build A matrix (2D/3D Laplacian)
A = zeros(N);
dists = [dx, dx, dy, dy];
for idx = 1:N
tmp = idx – 1;
ix = mod(tmp, nx) + 1;
iy = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
iz = 1;
else
iz = floor(tmp / (nx * ny)) + 1;
end
diagSum = 0;
nbr = [-1,0; 1,0; 0,-1; 0,1];
for k = 1:4
x2 = ix + nbr(k,1);
y2 = iy + nbr(k,2);
if x2>=1 && x2<=nx && y2>=1 && y2<=ny
z2 = iz;
idx2 = x2 + (y2-1)*nx + (z2-1)*nx*ny;
K = Lambda / (rho * cp * dists(k)^2);
A(idx, idx2) = K;
diagSum = diagSum + K;
end
end
A(idx, idx) = -diagSum;
end
% Build B matrix
% Identify side (Dirichlet) nodes
side = false(N,1);
for idx = 1:N
tmp = idx – 1;
x = mod(tmp, nx) + 1;
y = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
side(idx) = (x == 1) || (x == nx);
else
z = floor(tmp / (nx * ny)) + 1;
side(idx) = (x==1)||(x==nx)||(y==1)||(y==ny);
end
end
Nside = sum(side);
B = zeros(N, Nside + 1 + expectedNbot);
% Side BC inputs
sidx = find(side);
for i = 1:Nside
B(sidx(i), i) = 1;
end
% Top convection BC
if strcmp(modellTyp,’2D’)
topIdx = find(~side & floor((0:N-1)/nx)==0);
else
topIdx = find(~side & floor((0:N-1)/(nx*ny))==nz-1);
end
for i = 1:numel(topIdx)
B(topIdx(i), Nside+1) = h_top;
end
% Bottom convection BC
if strcmp(modellTyp,’2D’)
botIdx = find(~side & floor((0:N-1)/nx)==ny-1);
else
botIdx = find(~side & floor((0:N-1)/(nx*ny))==0);
end
for i = 1:numel(botIdx)
B(botIdx(i), Nside+1+i) = hBot(i);
end
% Outputs and feedthrough
C = eye(N);
% === Corner and edge nodes averaging ===
for idx = 1:N
bcCount = nnz(B(idx,:)); % Count of BC-Input
if bcCount > 1
% Balanced averaging: scale A- and B-Line
A(idx,:) = A(idx,:) / bcCount;
B(idx,:) = B(idx,:) / bcCount;
end
end
D = zeros(N, size(B,2));(N, size(B,2));
end
I’m not sure if this is the rigth approach.
Maybe someone has a hint how can I get rid of the errors.
With best regards
SteffenHello,
I’m struggeling a litle bit with a thermal model based on the two and thre dimensional heat equation.
My aim is to estimate the HCT with the aid of "experimental data" and a grey-box model.
The thermal BC’s are quite simple, and illustrated below.
I generate dummy data via this matalb script:
% generate_dummy_tempdata_and_model_fixed.m
% Generate Dummy-data and prepare (2D/3D)
clc, close all, clear all
%% === Parameter ===
modellTyp = "3D"; % "2D" or "3D"
nx = 4; ny = 4; nz = 4; % Node count
dx = 0.02;dy = 0.03; dz = 0.04; % Node distance [m]
times = 0:1:30; % Time range [s]
T0 = 300; % Initial temperature [K]
dt = times(2) – times(1); % Time step [s]
%% === 1) Generate dummy-data and save as CSV ===
data = [];
switch modellTyp
case "2D"
for iy = 0:ny-1
for ix = 0:nx-1
x = ix * dx;
y = iy * dy;
Tcurve = T0 + 10 * sin(2*pi*times/60 + ix*0.3 + iy*0.5);
data = [data; x, y, Tcurve];
end
end
% Header ass string array
header = ["x","y", "t" + string(times)];
csvFile = ‘example_tempdata2D.csv’;
case "3D"
for iz = 0:nz-1
for iy = 0:ny-1
for ix = 0:nx-1
x = ix * dx;
y = iy * dy;
z = iz * dz;
Tcurve = T0 + 10 * sin(2*pi*times/60 + ix*0.2 + iy*0.3 + iz*0.4);
data = [data; x, y, z, Tcurve];
end
end
end
% Header as string array
header = ["x","y","z", "t" + string(times)];
csvFile = ‘example_tempdata3D.csv’;
end
% Bulid table and save
Ttbl_out = array2table(data, ‘VariableNames’, header);
writetable(Ttbl_out, csvFile);
disp([‘Dummy-data saved: ‘, csvFile]);
The core of the simulation is the transformation of the 2d and 3d diffusion equation into an ode.
I do it with this script:
function [A,B,C,D] = fHeat2D3D(theta, Ts)
% fHeat2D3D Continuous-time grey-box state-space for 2D/3D heat diffusion
% Signature for idgrey: fHeat2D3D(theta, Ts)
% Inputs:
% theta = [Lambda, rho, cp, hBot1, …, hBotN]
% Ts = sample time (ignored in continuous-time model)
% Globals: nx, ny, nz, dx, dy, dz, modellTyp, h_top
global nx ny nz dx dy dz modellTyp h_top
% Extract physical parameters
Lambda = theta(1);
rho = theta(2);
cp = theta(3);
% Determine expected number of bottom convection coefficients
if strcmp(modellTyp,’2D’)
expectedNbot = nx;
else
expectedNbot = nx * nz;
end
% Validate theta length
if length(theta) ~= 3 + expectedNbot
error(‘Theta must have length 3+%d (got %d)’, expectedNbot, length(theta));
end
% Extract bottom convection coefficients
hBot = theta(4:end);
% Number of states
if strcmp(modellTyp,’2D’)
N = nx * ny;
else
N = nx * ny * nz;
end
% Build A matrix (2D/3D Laplacian)
A = zeros(N);
dists = [dx, dx, dy, dy];
for idx = 1:N
tmp = idx – 1;
ix = mod(tmp, nx) + 1;
iy = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
iz = 1;
else
iz = floor(tmp / (nx * ny)) + 1;
end
diagSum = 0;
nbr = [-1,0; 1,0; 0,-1; 0,1];
for k = 1:4
x2 = ix + nbr(k,1);
y2 = iy + nbr(k,2);
if x2>=1 && x2<=nx && y2>=1 && y2<=ny
z2 = iz;
idx2 = x2 + (y2-1)*nx + (z2-1)*nx*ny;
K = Lambda / (rho * cp * dists(k)^2);
A(idx, idx2) = K;
diagSum = diagSum + K;
end
end
A(idx, idx) = -diagSum;
end
% Build B matrix
% Identify side (Dirichlet) nodes
side = false(N,1);
for idx = 1:N
tmp = idx – 1;
x = mod(tmp, nx) + 1;
y = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
side(idx) = (x == 1) || (x == nx);
else
z = floor(tmp / (nx * ny)) + 1;
side(idx) = (x==1)||(x==nx)||(y==1)||(y==ny);
end
end
Nside = sum(side);
B = zeros(N, Nside + 1 + expectedNbot);
% Side BC inputs
sidx = find(side);
for i = 1:Nside
B(sidx(i), i) = 1;
end
% Top convection BC
if strcmp(modellTyp,’2D’)
topIdx = find(~side & floor((0:N-1)/nx)==0);
else
topIdx = find(~side & floor((0:N-1)/(nx*ny))==nz-1);
end
for i = 1:numel(topIdx)
B(topIdx(i), Nside+1) = h_top;
end
% Bottom convection BC
if strcmp(modellTyp,’2D’)
botIdx = find(~side & floor((0:N-1)/nx)==ny-1);
else
botIdx = find(~side & floor((0:N-1)/(nx*ny))==0);
end
for i = 1:numel(botIdx)
B(botIdx(i), Nside+1+i) = hBot(i);
end
% Outputs and feedthrough
C = eye(N);
D = zeros(N, size(B,2));
end
Finally the ode ("function [A,B,C,D] = fHeat2D3D(theta, Ts)") is used as continuous-time state-space model to estimate the system parameter HTC(bottom), heat conductivity, density and specific heat capacity via idgrey and greyest.
% greybox_heat_diffusion.m
% Parametric continuous-time grey-box model for 2D/3D heat conduction
clear; clc; close all;
global nx ny nz dx dy dz modellTyp h_top t_env_top
%% === User setup ===
modellTyp = "2D"; % "2D" or "3D"
nx = 3; ny = 3; nz = 3; % Count of nodes in x, y, z direction(ignore nz for 2D)
dx = 0.02; dy = 0.03; dz = 0.04; % Distance between nodes [m]
dt = 1; % Time step [s]
times = 0:dt:60; % Time range [s]
csv2D = ‘example_tempdata2D.csv’;
csv3D = ‘example_tempdata3D.csv’;
% Fixed values / Top-HTC
t_env_top = 293; % Ambient free stream temperature [K]
h_top = 10; % HTC at the top edge [W/(m^2*K)]
%% === Initial guess of the model parameter ===
theta0.Lambda = 50; % Heat conduction [W/(m*K)]
theta0.rho = 7800;% Density [kg/m^3]
theta0.cp = 460; % Heat capacity [J/(kg*K)]
if modellTyp=="2D"
h_bot0 = 20*ones(nx,1);
else
h_bot0 = 20*ones(nx*nz,1);
end
%% === Read experimental data ===
if modellTyp=="2D"
Tdata = readtable(csv2D);
Texp = Tdata{:,3:end};
Nstates = nx*ny;
else
Tdata = readtable(csv3D);
Texp = Tdata{:,4:end};
Nstates = nx*ny*nz;
end
Nmeas = size(Texp,2);
%% === Calculate side indices ===
sideNodes = false(Nstates,1);
for idx=1:Nstates
tmp=idx-1; ix=mod(tmp,nx)+1; iy=floor(tmp/nx)+1;
if strcmp(modellTyp,"2D")
sideNodes(idx) = ix==1 || ix==nx;
else
iz=floor(tmp/(nx*ny))+1;
sideNodes(idx) = ix==1||ix==nx||iy==1||iy==ny;
end
end
sideIdx = find(sideNodes);
%% === Build input-matrix u ===
T_sideBC = Texp(sideIdx,:); % Side nodes – BC (experimental value)
T_topBC = t_env_top * ones(1,Nmeas);
u = [T_sideBC’ T_topBC’ zeros(Nmeas,length(h_bot0))];
%% === idgrey Setup ===
param0 = [theta0.Lambda theta0.rho theta0.cp h_bot0′];
order = [Nstates Nstates Nstates 0];
[A,B,C,D] = fHeat2D3D(param0, dt);
sysi = idgrey(‘fHeat2D3D’, param0, ‘c’, order, …
‘InputName’,[repmat({‘T_sideBC’},1,length(sideIdx)) {‘T_top’} repmat({‘T_bot’},1,length(h_bot0))], …
‘OutputName’, repmat({‘Tnode’},1,Nstates));
% Release parameters (all)
sysi.Structure.Parameters.Free = true;
%% === Parameter-estimation ===
data_id = iddata(Texp’, u, dt);
opt = greyestOptions(‘Display’,’on’,’InitialCondition’,’zero’);
sys_est = greyest(data_id, sysi, opt);
%% === Extract estimated values ===
th = sys_est.Structure.Parameters;
Lambda_est = th(1).Value; rho_est = th(2).Value; cp_est = th(3).Value;
hBot_est = [th(4:end).Value]’;
%% === Plots ===
Tsim = sim(sys_est, data_id);
% Plot h_bot
figure;
if strcmp(modellTyp,"2D")
plot(unique(Tdata.x), hBot_est, ‘o-‘, ‘LineWidth’, 2);
xlabel(‘x [m]’); ylabel(‘h_{bot} [W/m^2K]’);
title(‘HTC at the bottom edge (2D)’); grid on;
else
% 3D-Surface plot of h_bot at bottom surface
[Xq, Zq] = meshgrid(unique(Tdata.x), unique(Tdata.z));
hq = griddata(Tdata.x, Tdata.z, hBot_est, Xq, Zq, ‘natural’);
surf(Xq, Zq, hq);
xlabel(‘x [m]’); ylabel(‘z [m]’); zlabel(‘h_{bot} [W/m^2K]’);
title(‘HTC at bottom surface (3D)’); colorbar;
shading interp; view(30, 30);
end
% Comparison temperature-simulation vs. temperature-measurement
figure;
Nrow = ceil(sqrt(Nstates));
for i = 1:Nstates
subplot(Nrow, Nrow, i);
plot(times, Texp(i,:), ‘-‘, ‘LineWidth’, 1.5); hold on;
plot(times, Tsim.y(i,:), ‘:’, ‘LineWidth’, 1.5);
title(sprintf(‘Nodes %d’, i));
xlabel(‘Time [s]’); ylabel(‘T [°C]’);
legend(‘Experiment’, ‘Simulation’);
grid on;
end
% 3D-Point: final temperature distribution
if strcmp(modellTyp,"3D")
figure;
scatter3(Tdata.x, Tdata.y, Tdata.z, 50, Tsim.y(:,end), ‘filled’);
xlabel(‘x’); ylabel(‘y’); zlabel(‘z’);
title(‘Simulated temperature distribution at t=tend’);
colorbar; view(30,30);
end
%% End of the script
The call of the script "greybox_heat_diffusion.m" is not working properly and the function "fHeat2D3D" is not called correct.
For the averaging of the corne nodes (2D) respectively the corner & edge nodes (3D). I made this script:
function [A,B,C,D] = fHeat2D3D(theta, Ts)
% fHeat2D3D Continuous-time grey-box state-space for 2D/3D heat diffusion
% Signature for idgrey: fHeat2D3D(theta, Ts)
% Inputs:
% theta = [Lambda, rho, cp, hBot1, …, hBotN]
% Ts = sample time (ignored in continuous-time model)
% Globals: nx, ny, nz, dx, dy, dz, modellTyp, h_top
global nx ny nz dx dy dz modellTyp h_top
% Extract physical parameters
Lambda = theta(1);
rho = theta(2);
cp = theta(3);
% Determine expected number of bottom convection coefficients
if strcmp(modellTyp,’2D’)
expectedNbot = nx;
else
expectedNbot = nx * nz;
end
% Validate theta length
if length(theta) ~= 3 + expectedNbot
error(‘Theta must have length 3+%d (got %d)’, expectedNbot, length(theta));
end
% Extract bottom convection coefficients
hBot = theta(4:end);
% Number of states
if strcmp(modellTyp,’2D’)
N = nx * ny;
else
N = nx * ny * nz;
end
% Build A matrix (2D/3D Laplacian)
A = zeros(N);
dists = [dx, dx, dy, dy];
for idx = 1:N
tmp = idx – 1;
ix = mod(tmp, nx) + 1;
iy = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
iz = 1;
else
iz = floor(tmp / (nx * ny)) + 1;
end
diagSum = 0;
nbr = [-1,0; 1,0; 0,-1; 0,1];
for k = 1:4
x2 = ix + nbr(k,1);
y2 = iy + nbr(k,2);
if x2>=1 && x2<=nx && y2>=1 && y2<=ny
z2 = iz;
idx2 = x2 + (y2-1)*nx + (z2-1)*nx*ny;
K = Lambda / (rho * cp * dists(k)^2);
A(idx, idx2) = K;
diagSum = diagSum + K;
end
end
A(idx, idx) = -diagSum;
end
% Build B matrix
% Identify side (Dirichlet) nodes
side = false(N,1);
for idx = 1:N
tmp = idx – 1;
x = mod(tmp, nx) + 1;
y = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
side(idx) = (x == 1) || (x == nx);
else
z = floor(tmp / (nx * ny)) + 1;
side(idx) = (x==1)||(x==nx)||(y==1)||(y==ny);
end
end
Nside = sum(side);
B = zeros(N, Nside + 1 + expectedNbot);
% Side BC inputs
sidx = find(side);
for i = 1:Nside
B(sidx(i), i) = 1;
end
% Top convection BC
if strcmp(modellTyp,’2D’)
topIdx = find(~side & floor((0:N-1)/nx)==0);
else
topIdx = find(~side & floor((0:N-1)/(nx*ny))==nz-1);
end
for i = 1:numel(topIdx)
B(topIdx(i), Nside+1) = h_top;
end
% Bottom convection BC
if strcmp(modellTyp,’2D’)
botIdx = find(~side & floor((0:N-1)/nx)==ny-1);
else
botIdx = find(~side & floor((0:N-1)/(nx*ny))==0);
end
for i = 1:numel(botIdx)
B(botIdx(i), Nside+1+i) = hBot(i);
end
% Outputs and feedthrough
C = eye(N);
% === Corner and edge nodes averaging ===
for idx = 1:N
bcCount = nnz(B(idx,:)); % Count of BC-Input
if bcCount > 1
% Balanced averaging: scale A- and B-Line
A(idx,:) = A(idx,:) / bcCount;
B(idx,:) = B(idx,:) / bcCount;
end
end
D = zeros(N, size(B,2));(N, size(B,2));
end
I’m not sure if this is the rigth approach.
Maybe someone has a hint how can I get rid of the errors.
With best regards
Steffen Hello,
I’m struggeling a litle bit with a thermal model based on the two and thre dimensional heat equation.
My aim is to estimate the HCT with the aid of "experimental data" and a grey-box model.
The thermal BC’s are quite simple, and illustrated below.
I generate dummy data via this matalb script:
% generate_dummy_tempdata_and_model_fixed.m
% Generate Dummy-data and prepare (2D/3D)
clc, close all, clear all
%% === Parameter ===
modellTyp = "3D"; % "2D" or "3D"
nx = 4; ny = 4; nz = 4; % Node count
dx = 0.02;dy = 0.03; dz = 0.04; % Node distance [m]
times = 0:1:30; % Time range [s]
T0 = 300; % Initial temperature [K]
dt = times(2) – times(1); % Time step [s]
%% === 1) Generate dummy-data and save as CSV ===
data = [];
switch modellTyp
case "2D"
for iy = 0:ny-1
for ix = 0:nx-1
x = ix * dx;
y = iy * dy;
Tcurve = T0 + 10 * sin(2*pi*times/60 + ix*0.3 + iy*0.5);
data = [data; x, y, Tcurve];
end
end
% Header ass string array
header = ["x","y", "t" + string(times)];
csvFile = ‘example_tempdata2D.csv’;
case "3D"
for iz = 0:nz-1
for iy = 0:ny-1
for ix = 0:nx-1
x = ix * dx;
y = iy * dy;
z = iz * dz;
Tcurve = T0 + 10 * sin(2*pi*times/60 + ix*0.2 + iy*0.3 + iz*0.4);
data = [data; x, y, z, Tcurve];
end
end
end
% Header as string array
header = ["x","y","z", "t" + string(times)];
csvFile = ‘example_tempdata3D.csv’;
end
% Bulid table and save
Ttbl_out = array2table(data, ‘VariableNames’, header);
writetable(Ttbl_out, csvFile);
disp([‘Dummy-data saved: ‘, csvFile]);
The core of the simulation is the transformation of the 2d and 3d diffusion equation into an ode.
I do it with this script:
function [A,B,C,D] = fHeat2D3D(theta, Ts)
% fHeat2D3D Continuous-time grey-box state-space for 2D/3D heat diffusion
% Signature for idgrey: fHeat2D3D(theta, Ts)
% Inputs:
% theta = [Lambda, rho, cp, hBot1, …, hBotN]
% Ts = sample time (ignored in continuous-time model)
% Globals: nx, ny, nz, dx, dy, dz, modellTyp, h_top
global nx ny nz dx dy dz modellTyp h_top
% Extract physical parameters
Lambda = theta(1);
rho = theta(2);
cp = theta(3);
% Determine expected number of bottom convection coefficients
if strcmp(modellTyp,’2D’)
expectedNbot = nx;
else
expectedNbot = nx * nz;
end
% Validate theta length
if length(theta) ~= 3 + expectedNbot
error(‘Theta must have length 3+%d (got %d)’, expectedNbot, length(theta));
end
% Extract bottom convection coefficients
hBot = theta(4:end);
% Number of states
if strcmp(modellTyp,’2D’)
N = nx * ny;
else
N = nx * ny * nz;
end
% Build A matrix (2D/3D Laplacian)
A = zeros(N);
dists = [dx, dx, dy, dy];
for idx = 1:N
tmp = idx – 1;
ix = mod(tmp, nx) + 1;
iy = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
iz = 1;
else
iz = floor(tmp / (nx * ny)) + 1;
end
diagSum = 0;
nbr = [-1,0; 1,0; 0,-1; 0,1];
for k = 1:4
x2 = ix + nbr(k,1);
y2 = iy + nbr(k,2);
if x2>=1 && x2<=nx && y2>=1 && y2<=ny
z2 = iz;
idx2 = x2 + (y2-1)*nx + (z2-1)*nx*ny;
K = Lambda / (rho * cp * dists(k)^2);
A(idx, idx2) = K;
diagSum = diagSum + K;
end
end
A(idx, idx) = -diagSum;
end
% Build B matrix
% Identify side (Dirichlet) nodes
side = false(N,1);
for idx = 1:N
tmp = idx – 1;
x = mod(tmp, nx) + 1;
y = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
side(idx) = (x == 1) || (x == nx);
else
z = floor(tmp / (nx * ny)) + 1;
side(idx) = (x==1)||(x==nx)||(y==1)||(y==ny);
end
end
Nside = sum(side);
B = zeros(N, Nside + 1 + expectedNbot);
% Side BC inputs
sidx = find(side);
for i = 1:Nside
B(sidx(i), i) = 1;
end
% Top convection BC
if strcmp(modellTyp,’2D’)
topIdx = find(~side & floor((0:N-1)/nx)==0);
else
topIdx = find(~side & floor((0:N-1)/(nx*ny))==nz-1);
end
for i = 1:numel(topIdx)
B(topIdx(i), Nside+1) = h_top;
end
% Bottom convection BC
if strcmp(modellTyp,’2D’)
botIdx = find(~side & floor((0:N-1)/nx)==ny-1);
else
botIdx = find(~side & floor((0:N-1)/(nx*ny))==0);
end
for i = 1:numel(botIdx)
B(botIdx(i), Nside+1+i) = hBot(i);
end
% Outputs and feedthrough
C = eye(N);
D = zeros(N, size(B,2));
end
Finally the ode ("function [A,B,C,D] = fHeat2D3D(theta, Ts)") is used as continuous-time state-space model to estimate the system parameter HTC(bottom), heat conductivity, density and specific heat capacity via idgrey and greyest.
% greybox_heat_diffusion.m
% Parametric continuous-time grey-box model for 2D/3D heat conduction
clear; clc; close all;
global nx ny nz dx dy dz modellTyp h_top t_env_top
%% === User setup ===
modellTyp = "2D"; % "2D" or "3D"
nx = 3; ny = 3; nz = 3; % Count of nodes in x, y, z direction(ignore nz for 2D)
dx = 0.02; dy = 0.03; dz = 0.04; % Distance between nodes [m]
dt = 1; % Time step [s]
times = 0:dt:60; % Time range [s]
csv2D = ‘example_tempdata2D.csv’;
csv3D = ‘example_tempdata3D.csv’;
% Fixed values / Top-HTC
t_env_top = 293; % Ambient free stream temperature [K]
h_top = 10; % HTC at the top edge [W/(m^2*K)]
%% === Initial guess of the model parameter ===
theta0.Lambda = 50; % Heat conduction [W/(m*K)]
theta0.rho = 7800;% Density [kg/m^3]
theta0.cp = 460; % Heat capacity [J/(kg*K)]
if modellTyp=="2D"
h_bot0 = 20*ones(nx,1);
else
h_bot0 = 20*ones(nx*nz,1);
end
%% === Read experimental data ===
if modellTyp=="2D"
Tdata = readtable(csv2D);
Texp = Tdata{:,3:end};
Nstates = nx*ny;
else
Tdata = readtable(csv3D);
Texp = Tdata{:,4:end};
Nstates = nx*ny*nz;
end
Nmeas = size(Texp,2);
%% === Calculate side indices ===
sideNodes = false(Nstates,1);
for idx=1:Nstates
tmp=idx-1; ix=mod(tmp,nx)+1; iy=floor(tmp/nx)+1;
if strcmp(modellTyp,"2D")
sideNodes(idx) = ix==1 || ix==nx;
else
iz=floor(tmp/(nx*ny))+1;
sideNodes(idx) = ix==1||ix==nx||iy==1||iy==ny;
end
end
sideIdx = find(sideNodes);
%% === Build input-matrix u ===
T_sideBC = Texp(sideIdx,:); % Side nodes – BC (experimental value)
T_topBC = t_env_top * ones(1,Nmeas);
u = [T_sideBC’ T_topBC’ zeros(Nmeas,length(h_bot0))];
%% === idgrey Setup ===
param0 = [theta0.Lambda theta0.rho theta0.cp h_bot0′];
order = [Nstates Nstates Nstates 0];
[A,B,C,D] = fHeat2D3D(param0, dt);
sysi = idgrey(‘fHeat2D3D’, param0, ‘c’, order, …
‘InputName’,[repmat({‘T_sideBC’},1,length(sideIdx)) {‘T_top’} repmat({‘T_bot’},1,length(h_bot0))], …
‘OutputName’, repmat({‘Tnode’},1,Nstates));
% Release parameters (all)
sysi.Structure.Parameters.Free = true;
%% === Parameter-estimation ===
data_id = iddata(Texp’, u, dt);
opt = greyestOptions(‘Display’,’on’,’InitialCondition’,’zero’);
sys_est = greyest(data_id, sysi, opt);
%% === Extract estimated values ===
th = sys_est.Structure.Parameters;
Lambda_est = th(1).Value; rho_est = th(2).Value; cp_est = th(3).Value;
hBot_est = [th(4:end).Value]’;
%% === Plots ===
Tsim = sim(sys_est, data_id);
% Plot h_bot
figure;
if strcmp(modellTyp,"2D")
plot(unique(Tdata.x), hBot_est, ‘o-‘, ‘LineWidth’, 2);
xlabel(‘x [m]’); ylabel(‘h_{bot} [W/m^2K]’);
title(‘HTC at the bottom edge (2D)’); grid on;
else
% 3D-Surface plot of h_bot at bottom surface
[Xq, Zq] = meshgrid(unique(Tdata.x), unique(Tdata.z));
hq = griddata(Tdata.x, Tdata.z, hBot_est, Xq, Zq, ‘natural’);
surf(Xq, Zq, hq);
xlabel(‘x [m]’); ylabel(‘z [m]’); zlabel(‘h_{bot} [W/m^2K]’);
title(‘HTC at bottom surface (3D)’); colorbar;
shading interp; view(30, 30);
end
% Comparison temperature-simulation vs. temperature-measurement
figure;
Nrow = ceil(sqrt(Nstates));
for i = 1:Nstates
subplot(Nrow, Nrow, i);
plot(times, Texp(i,:), ‘-‘, ‘LineWidth’, 1.5); hold on;
plot(times, Tsim.y(i,:), ‘:’, ‘LineWidth’, 1.5);
title(sprintf(‘Nodes %d’, i));
xlabel(‘Time [s]’); ylabel(‘T [°C]’);
legend(‘Experiment’, ‘Simulation’);
grid on;
end
% 3D-Point: final temperature distribution
if strcmp(modellTyp,"3D")
figure;
scatter3(Tdata.x, Tdata.y, Tdata.z, 50, Tsim.y(:,end), ‘filled’);
xlabel(‘x’); ylabel(‘y’); zlabel(‘z’);
title(‘Simulated temperature distribution at t=tend’);
colorbar; view(30,30);
end
%% End of the script
The call of the script "greybox_heat_diffusion.m" is not working properly and the function "fHeat2D3D" is not called correct.
For the averaging of the corne nodes (2D) respectively the corner & edge nodes (3D). I made this script:
function [A,B,C,D] = fHeat2D3D(theta, Ts)
% fHeat2D3D Continuous-time grey-box state-space for 2D/3D heat diffusion
% Signature for idgrey: fHeat2D3D(theta, Ts)
% Inputs:
% theta = [Lambda, rho, cp, hBot1, …, hBotN]
% Ts = sample time (ignored in continuous-time model)
% Globals: nx, ny, nz, dx, dy, dz, modellTyp, h_top
global nx ny nz dx dy dz modellTyp h_top
% Extract physical parameters
Lambda = theta(1);
rho = theta(2);
cp = theta(3);
% Determine expected number of bottom convection coefficients
if strcmp(modellTyp,’2D’)
expectedNbot = nx;
else
expectedNbot = nx * nz;
end
% Validate theta length
if length(theta) ~= 3 + expectedNbot
error(‘Theta must have length 3+%d (got %d)’, expectedNbot, length(theta));
end
% Extract bottom convection coefficients
hBot = theta(4:end);
% Number of states
if strcmp(modellTyp,’2D’)
N = nx * ny;
else
N = nx * ny * nz;
end
% Build A matrix (2D/3D Laplacian)
A = zeros(N);
dists = [dx, dx, dy, dy];
for idx = 1:N
tmp = idx – 1;
ix = mod(tmp, nx) + 1;
iy = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
iz = 1;
else
iz = floor(tmp / (nx * ny)) + 1;
end
diagSum = 0;
nbr = [-1,0; 1,0; 0,-1; 0,1];
for k = 1:4
x2 = ix + nbr(k,1);
y2 = iy + nbr(k,2);
if x2>=1 && x2<=nx && y2>=1 && y2<=ny
z2 = iz;
idx2 = x2 + (y2-1)*nx + (z2-1)*nx*ny;
K = Lambda / (rho * cp * dists(k)^2);
A(idx, idx2) = K;
diagSum = diagSum + K;
end
end
A(idx, idx) = -diagSum;
end
% Build B matrix
% Identify side (Dirichlet) nodes
side = false(N,1);
for idx = 1:N
tmp = idx – 1;
x = mod(tmp, nx) + 1;
y = floor(tmp / nx) + 1;
if strcmp(modellTyp,’2D’)
side(idx) = (x == 1) || (x == nx);
else
z = floor(tmp / (nx * ny)) + 1;
side(idx) = (x==1)||(x==nx)||(y==1)||(y==ny);
end
end
Nside = sum(side);
B = zeros(N, Nside + 1 + expectedNbot);
% Side BC inputs
sidx = find(side);
for i = 1:Nside
B(sidx(i), i) = 1;
end
% Top convection BC
if strcmp(modellTyp,’2D’)
topIdx = find(~side & floor((0:N-1)/nx)==0);
else
topIdx = find(~side & floor((0:N-1)/(nx*ny))==nz-1);
end
for i = 1:numel(topIdx)
B(topIdx(i), Nside+1) = h_top;
end
% Bottom convection BC
if strcmp(modellTyp,’2D’)
botIdx = find(~side & floor((0:N-1)/nx)==ny-1);
else
botIdx = find(~side & floor((0:N-1)/(nx*ny))==0);
end
for i = 1:numel(botIdx)
B(botIdx(i), Nside+1+i) = hBot(i);
end
% Outputs and feedthrough
C = eye(N);
% === Corner and edge nodes averaging ===
for idx = 1:N
bcCount = nnz(B(idx,:)); % Count of BC-Input
if bcCount > 1
% Balanced averaging: scale A- and B-Line
A(idx,:) = A(idx,:) / bcCount;
B(idx,:) = B(idx,:) / bcCount;
end
end
D = zeros(N, size(B,2));(N, size(B,2));
end
I’m not sure if this is the rigth approach.
Maybe someone has a hint how can I get rid of the errors.
With best regards
Steffen thermal, grey-box, matlab, ode MATLAB Answers — New Questions
Edit Excel files to automatically update into MATLAB
I am trying to figure out how to edit an excel file and have those changes automatically update into MATLAB. Currently I am stuck copy and pasting the data into MATLAB to keep those updated numbers. Finally, this excel is in a shared folder on Microsoft Teams. I am unable to download to my drive or import directly to MATLAB because anyone can make that update to change the values.
I’ve tried "actxserver(‘excel.application’)" but received an error that it’s not supported.
Thanks!I am trying to figure out how to edit an excel file and have those changes automatically update into MATLAB. Currently I am stuck copy and pasting the data into MATLAB to keep those updated numbers. Finally, this excel is in a shared folder on Microsoft Teams. I am unable to download to my drive or import directly to MATLAB because anyone can make that update to change the values.
I’ve tried "actxserver(‘excel.application’)" but received an error that it’s not supported.
Thanks! I am trying to figure out how to edit an excel file and have those changes automatically update into MATLAB. Currently I am stuck copy and pasting the data into MATLAB to keep those updated numbers. Finally, this excel is in a shared folder on Microsoft Teams. I am unable to download to my drive or import directly to MATLAB because anyone can make that update to change the values.
I’ve tried "actxserver(‘excel.application’)" but received an error that it’s not supported.
Thanks! excel, importing excel data MATLAB Answers — New Questions
Access to higher resolutions in 48MP USB camera
I am using a 48MP USB camera – this one specifically: https://www.elpcctv.com/elp-48mp-high-resolution-usb-camera-with-varifocal-cs-3610mm-lens-p-443.html
I am using a Macbook Apple M2 (Sequoia 15.6) and thus using the ‘macvideo’ Adaptor … the problem is that although this is a 48MP camera – so a max resolution of 8000×6000 at low FPS, the highest res returned is 3840×2160 (see below). I guess this is because this is a "generic" adaptor?? Is there any way in which I can tap into all of the possible resolutions of this camera using matlab? (I note that the manufacturer says the high res are availabile via a different codec – MJPEG vs YUY2 (8000×6000 @ 5fps MJPEG / 4000×3000 @ 12fps MJPEG
3840×2160 @ 30fps MJPEG) could this be the main issue?
Any pointers greatly appreciated …
Thanks
>> imaqhwinfo(‘macvideo’,1)
ans =
struct with fields:
DefaultFormat: ‘YCbCr422_1920x1080’
DeviceFileSupported: 0
DeviceName: ’48MP USB Camera’
DeviceID: 1
VideoInputConstructor: ‘videoinput(‘macvideo’, 1)’
VideoDeviceConstructor: ‘imaq.VideoDevice(‘macvideo’, 1)’
SupportedFormats: {‘YCbCr422_1280x720’ ‘YCbCr422_1920x1080’ ‘YCbCr422_192x144’ ‘YCbCr422_320x240’ ‘YCbCr422_352x288’ ‘YCbCr422_3840x2160’ ‘YCbCr422_480x360’ ‘YCbCr422_960x540’}
>>I am using a 48MP USB camera – this one specifically: https://www.elpcctv.com/elp-48mp-high-resolution-usb-camera-with-varifocal-cs-3610mm-lens-p-443.html
I am using a Macbook Apple M2 (Sequoia 15.6) and thus using the ‘macvideo’ Adaptor … the problem is that although this is a 48MP camera – so a max resolution of 8000×6000 at low FPS, the highest res returned is 3840×2160 (see below). I guess this is because this is a "generic" adaptor?? Is there any way in which I can tap into all of the possible resolutions of this camera using matlab? (I note that the manufacturer says the high res are availabile via a different codec – MJPEG vs YUY2 (8000×6000 @ 5fps MJPEG / 4000×3000 @ 12fps MJPEG
3840×2160 @ 30fps MJPEG) could this be the main issue?
Any pointers greatly appreciated …
Thanks
>> imaqhwinfo(‘macvideo’,1)
ans =
struct with fields:
DefaultFormat: ‘YCbCr422_1920x1080’
DeviceFileSupported: 0
DeviceName: ’48MP USB Camera’
DeviceID: 1
VideoInputConstructor: ‘videoinput(‘macvideo’, 1)’
VideoDeviceConstructor: ‘imaq.VideoDevice(‘macvideo’, 1)’
SupportedFormats: {‘YCbCr422_1280x720’ ‘YCbCr422_1920x1080’ ‘YCbCr422_192x144’ ‘YCbCr422_320x240’ ‘YCbCr422_352x288’ ‘YCbCr422_3840x2160’ ‘YCbCr422_480x360’ ‘YCbCr422_960x540’}
>> I am using a 48MP USB camera – this one specifically: https://www.elpcctv.com/elp-48mp-high-resolution-usb-camera-with-varifocal-cs-3610mm-lens-p-443.html
I am using a Macbook Apple M2 (Sequoia 15.6) and thus using the ‘macvideo’ Adaptor … the problem is that although this is a 48MP camera – so a max resolution of 8000×6000 at low FPS, the highest res returned is 3840×2160 (see below). I guess this is because this is a "generic" adaptor?? Is there any way in which I can tap into all of the possible resolutions of this camera using matlab? (I note that the manufacturer says the high res are availabile via a different codec – MJPEG vs YUY2 (8000×6000 @ 5fps MJPEG / 4000×3000 @ 12fps MJPEG
3840×2160 @ 30fps MJPEG) could this be the main issue?
Any pointers greatly appreciated …
Thanks
>> imaqhwinfo(‘macvideo’,1)
ans =
struct with fields:
DefaultFormat: ‘YCbCr422_1920x1080’
DeviceFileSupported: 0
DeviceName: ’48MP USB Camera’
DeviceID: 1
VideoInputConstructor: ‘videoinput(‘macvideo’, 1)’
VideoDeviceConstructor: ‘imaq.VideoDevice(‘macvideo’, 1)’
SupportedFormats: {‘YCbCr422_1280x720’ ‘YCbCr422_1920x1080’ ‘YCbCr422_192x144’ ‘YCbCr422_320x240’ ‘YCbCr422_352x288’ ‘YCbCr422_3840x2160’ ‘YCbCr422_480x360’ ‘YCbCr422_960x540’}
>> macvideo, usb camera, mjpeg, resolution MATLAB Answers — New Questions
R2025a: Simulink scope does not show full data resolution when zooming in during simulation
Hi all,
I use Simulink to run Simulations over long time-ranges (up to 1 year). Because the simulation run for up to 18 hours I use simulink scopes to monitor signals while the simulation is still running (e.g. to evaluate if newly programmed logics work as expected).
I realised that in R2025a the signals are no longer shown in full data resolution when zooming in during the simulation. Before I used R2023b and there the data was shown in full resolution.
Following example shows the difference between R2023b (expected behaviour) and R2025a:
R2023b:
R2025a:
Both images show the same time-range in the same scope of the same model during simulation.
In the scope settings under logging both "Limit dat points to last" and "Decimation" are disabled.
After the simulation is finished the signals in R2025a are also shown in full data resolution. The difference between the versions only appears during simulation.
Are there any possibilities to get the same behaviour during the simulation as in R2023b? As our simulations run for multiple hours it is important to have the possibility to evaluate the signals even before the simulations are finished.Hi all,
I use Simulink to run Simulations over long time-ranges (up to 1 year). Because the simulation run for up to 18 hours I use simulink scopes to monitor signals while the simulation is still running (e.g. to evaluate if newly programmed logics work as expected).
I realised that in R2025a the signals are no longer shown in full data resolution when zooming in during the simulation. Before I used R2023b and there the data was shown in full resolution.
Following example shows the difference between R2023b (expected behaviour) and R2025a:
R2023b:
R2025a:
Both images show the same time-range in the same scope of the same model during simulation.
In the scope settings under logging both "Limit dat points to last" and "Decimation" are disabled.
After the simulation is finished the signals in R2025a are also shown in full data resolution. The difference between the versions only appears during simulation.
Are there any possibilities to get the same behaviour during the simulation as in R2023b? As our simulations run for multiple hours it is important to have the possibility to evaluate the signals even before the simulations are finished. Hi all,
I use Simulink to run Simulations over long time-ranges (up to 1 year). Because the simulation run for up to 18 hours I use simulink scopes to monitor signals while the simulation is still running (e.g. to evaluate if newly programmed logics work as expected).
I realised that in R2025a the signals are no longer shown in full data resolution when zooming in during the simulation. Before I used R2023b and there the data was shown in full resolution.
Following example shows the difference between R2023b (expected behaviour) and R2025a:
R2023b:
R2025a:
Both images show the same time-range in the same scope of the same model during simulation.
In the scope settings under logging both "Limit dat points to last" and "Decimation" are disabled.
After the simulation is finished the signals in R2025a are also shown in full data resolution. The difference between the versions only appears during simulation.
Are there any possibilities to get the same behaviour during the simulation as in R2023b? As our simulations run for multiple hours it is important to have the possibility to evaluate the signals even before the simulations are finished. scope MATLAB Answers — New Questions
Warning when executing Matlab executable application built with Matlab 2022b
I am building a Matlab executable with Matlab 2022b (including Matlab Compiler). The build is ok and the application works, but when I run it from Windows command prompt or powershell, I get this warning:
Warning: Executing startup failed in matlabrc.
This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was:
MATLAB:class:InvalidSuperClass
The specified superclass ‘Simulink.IntEnumType’ contains a parse error, cannot be found on MATLAB’s search path, or is shadowed by another file with the same name.
This also happen from another pc with another installation of Matlab, so it does not seem to be a specific problem of my pc. How can I get rid of the warning?I am building a Matlab executable with Matlab 2022b (including Matlab Compiler). The build is ok and the application works, but when I run it from Windows command prompt or powershell, I get this warning:
Warning: Executing startup failed in matlabrc.
This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was:
MATLAB:class:InvalidSuperClass
The specified superclass ‘Simulink.IntEnumType’ contains a parse error, cannot be found on MATLAB’s search path, or is shadowed by another file with the same name.
This also happen from another pc with another installation of Matlab, so it does not seem to be a specific problem of my pc. How can I get rid of the warning? I am building a Matlab executable with Matlab 2022b (including Matlab Compiler). The build is ok and the application works, but when I run it from Windows command prompt or powershell, I get this warning:
Warning: Executing startup failed in matlabrc.
This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was:
MATLAB:class:InvalidSuperClass
The specified superclass ‘Simulink.IntEnumType’ contains a parse error, cannot be found on MATLAB’s search path, or is shadowed by another file with the same name.
This also happen from another pc with another installation of Matlab, so it does not seem to be a specific problem of my pc. How can I get rid of the warning? matlab compiler MATLAB Answers — New Questions
Update Inport/outport and signal names faster
I am trying to update a lot of port and signal names. We usually use a prefix like "LvrA_" before all signal names to make code integration easier later. However if we ever need to change it to something like "Lvr1_" the fastest way I’ve found is to click in each box of the Model Data Editor for 100+ ports and signals. Is there a better way to do a find replace, export to a file that allows doing find replace and import or something else similar? Maybe I’ve been using poor keywords but I’ve been searching and can’t seem to find anything.I am trying to update a lot of port and signal names. We usually use a prefix like "LvrA_" before all signal names to make code integration easier later. However if we ever need to change it to something like "Lvr1_" the fastest way I’ve found is to click in each box of the Model Data Editor for 100+ ports and signals. Is there a better way to do a find replace, export to a file that allows doing find replace and import or something else similar? Maybe I’ve been using poor keywords but I’ve been searching and can’t seem to find anything. I am trying to update a lot of port and signal names. We usually use a prefix like "LvrA_" before all signal names to make code integration easier later. However if we ever need to change it to something like "Lvr1_" the fastest way I’ve found is to click in each box of the Model Data Editor for 100+ ports and signals. Is there a better way to do a find replace, export to a file that allows doing find replace and import or something else similar? Maybe I’ve been using poor keywords but I’ve been searching and can’t seem to find anything. inport, naming, signal MATLAB Answers — New Questions
Why is the definition of Weibull PDF not consistent across different MATLAB online documentation web pages?
I see that there is an inconsistency in the expressions of the Weibull distribution functions across two different MATLAB documentation pages.
1) Weibull Distribution (Statistics Toolbox): Here the expression is given as:
y = (b/a) * (x/a)^(b−1) * e^−((x/a)^b)
2) Weibull Distribution (Curve Fitting Toolbox): But here the expression is given as:
y = a * b * x^(b−1) * e^−((ax)^b)I see that there is an inconsistency in the expressions of the Weibull distribution functions across two different MATLAB documentation pages.
1) Weibull Distribution (Statistics Toolbox): Here the expression is given as:
y = (b/a) * (x/a)^(b−1) * e^−((x/a)^b)
2) Weibull Distribution (Curve Fitting Toolbox): But here the expression is given as:
y = a * b * x^(b−1) * e^−((ax)^b) I see that there is an inconsistency in the expressions of the Weibull distribution functions across two different MATLAB documentation pages.
1) Weibull Distribution (Statistics Toolbox): Here the expression is given as:
y = (b/a) * (x/a)^(b−1) * e^−((x/a)^b)
2) Weibull Distribution (Curve Fitting Toolbox): But here the expression is given as:
y = a * b * x^(b−1) * e^−((ax)^b) weibull, distribution MATLAB Answers — New Questions
Why does converting my model into a masked subsystem result in an error indicating a mismatch between the inferred signal size and the size determined by back propagation in MATLAB R2022a?
When I transform my model into a masked subsystem and run the Simulink model, I encounter the following error message:
Error:Inferred size (‘[<signal_size>]’) for data ‘y’ does not match back propagated size (‘scalar’) from Simulink.
Why does converting my model into a masked subsystem result in an error indicating a mismatch between the inferred signal size and the size determined by back propagation in MATLAB R2022a?When I transform my model into a masked subsystem and run the Simulink model, I encounter the following error message:
Error:Inferred size (‘[<signal_size>]’) for data ‘y’ does not match back propagated size (‘scalar’) from Simulink.
Why does converting my model into a masked subsystem result in an error indicating a mismatch between the inferred signal size and the size determined by back propagation in MATLAB R2022a? When I transform my model into a masked subsystem and run the Simulink model, I encounter the following error message:
Error:Inferred size (‘[<signal_size>]’) for data ‘y’ does not match back propagated size (‘scalar’) from Simulink.
Why does converting my model into a masked subsystem result in an error indicating a mismatch between the inferred signal size and the size determined by back propagation in MATLAB R2022a? inferred, signal, size, back, propagation, masked, subsystem MATLAB Answers — New Questions
How can I resolve the “Out of Memory” error without making any changes to the Simulink model?
I’m working with an large Simulink model and encounter an "Out of Memory" error during simulation. I prefer not to alter the model itself. How can I resolve the "Out of Memory" error without making any changes to the Simulink model?I’m working with an large Simulink model and encounter an "Out of Memory" error during simulation. I prefer not to alter the model itself. How can I resolve the "Out of Memory" error without making any changes to the Simulink model? I’m working with an large Simulink model and encounter an "Out of Memory" error during simulation. I prefer not to alter the model itself. How can I resolve the "Out of Memory" error without making any changes to the Simulink model? out, of, memory, operating, point, without, no, change MATLAB Answers — New Questions
Access class methods in one line only when you use brackets after class name.
Hello, I’m hoping someone can explain why you can access a class method in a single statement only when you use brackets after the class name.
For example, I have a class called Data, with method stats. Why does Data.stats raise and error, but Data().stats does not raise an error.
The brackets are not required to instantiate the class, i.e. D = Data is the same as D = Data().
Thanks,
Dale.Hello, I’m hoping someone can explain why you can access a class method in a single statement only when you use brackets after the class name.
For example, I have a class called Data, with method stats. Why does Data.stats raise and error, but Data().stats does not raise an error.
The brackets are not required to instantiate the class, i.e. D = Data is the same as D = Data().
Thanks,
Dale. Hello, I’m hoping someone can explain why you can access a class method in a single statement only when you use brackets after the class name.
For example, I have a class called Data, with method stats. Why does Data.stats raise and error, but Data().stats does not raise an error.
The brackets are not required to instantiate the class, i.e. D = Data is the same as D = Data().
Thanks,
Dale. object oriented, method calls MATLAB Answers — New Questions
How to find the switching losses (reverse recovery losses) of the antiparallel diodes that are in a power converter?
Hello,
My objective is to estimate both conduction and switching losses of semiconductor devices that are used in a DAB converter operation. I have built a simulator using the blocks which can be found in the Simscape library blocks. The semiconductors have been modeled using
1) IGBT (ideal switching) block – IGBT (Ideal, Switching) – Ideal insulated-gate bipolar transistor for switching applications – MATLAB
2) Diode block – Diode – Piecewise linear, exponential, or tabulated diode – MATLAB.
After building the simulator, I ran it for sometime and obtained the simscape results data log for further analysis. And as mentioned in ee_getPowerLossSummary – Calculate dissipated power losses and switching losses – MATLAB, I used that method to estimate both switching and conduction losses using log data. I suppose that the "power" output of the function corresponds to conduction losses. Please advice me otherwise. If the "power" provides the total losses. The provided link of the ee_getPowerLossSummary, it says that the function is capable of estimating both conduction and switching losses for the above devices. Also, highlights that the reverse recovery loss can also be obtained.
However, when I run the simulation and run the function ee_GetPowerLossSummary afterwards, It only provides the conduction losses of the diode. Always, the diode losses are given as zero. It provides the conduction and switching losses for the IGBT. I have modeled the diode for reverse recovery operation by adding values from the datasheet. I was wondering whether there are any additional options to configure to get this to work. Also, I can see that the switching losses of the IGBTs fall drastically when a deadtime is used between High and Low switches in a same leg. When deadtime is not used, a signficant amount of switching losses are present. These observations have been made using the aforementioned ee_getPowerLossSummary function and as well as post processing the instantaneuos power waveforms obtained through power sensors. I don’t understand this since switching losses apply even when the deadtime is used since it only happens due to the IGBT’s own voltage and current. Not by the temporary shootthrough that happens if deadtime is not used.
Any suggestion, comment or advice regarding this process is highly appreciated. Thank you.Hello,
My objective is to estimate both conduction and switching losses of semiconductor devices that are used in a DAB converter operation. I have built a simulator using the blocks which can be found in the Simscape library blocks. The semiconductors have been modeled using
1) IGBT (ideal switching) block – IGBT (Ideal, Switching) – Ideal insulated-gate bipolar transistor for switching applications – MATLAB
2) Diode block – Diode – Piecewise linear, exponential, or tabulated diode – MATLAB.
After building the simulator, I ran it for sometime and obtained the simscape results data log for further analysis. And as mentioned in ee_getPowerLossSummary – Calculate dissipated power losses and switching losses – MATLAB, I used that method to estimate both switching and conduction losses using log data. I suppose that the "power" output of the function corresponds to conduction losses. Please advice me otherwise. If the "power" provides the total losses. The provided link of the ee_getPowerLossSummary, it says that the function is capable of estimating both conduction and switching losses for the above devices. Also, highlights that the reverse recovery loss can also be obtained.
However, when I run the simulation and run the function ee_GetPowerLossSummary afterwards, It only provides the conduction losses of the diode. Always, the diode losses are given as zero. It provides the conduction and switching losses for the IGBT. I have modeled the diode for reverse recovery operation by adding values from the datasheet. I was wondering whether there are any additional options to configure to get this to work. Also, I can see that the switching losses of the IGBTs fall drastically when a deadtime is used between High and Low switches in a same leg. When deadtime is not used, a signficant amount of switching losses are present. These observations have been made using the aforementioned ee_getPowerLossSummary function and as well as post processing the instantaneuos power waveforms obtained through power sensors. I don’t understand this since switching losses apply even when the deadtime is used since it only happens due to the IGBT’s own voltage and current. Not by the temporary shootthrough that happens if deadtime is not used.
Any suggestion, comment or advice regarding this process is highly appreciated. Thank you. Hello,
My objective is to estimate both conduction and switching losses of semiconductor devices that are used in a DAB converter operation. I have built a simulator using the blocks which can be found in the Simscape library blocks. The semiconductors have been modeled using
1) IGBT (ideal switching) block – IGBT (Ideal, Switching) – Ideal insulated-gate bipolar transistor for switching applications – MATLAB
2) Diode block – Diode – Piecewise linear, exponential, or tabulated diode – MATLAB.
After building the simulator, I ran it for sometime and obtained the simscape results data log for further analysis. And as mentioned in ee_getPowerLossSummary – Calculate dissipated power losses and switching losses – MATLAB, I used that method to estimate both switching and conduction losses using log data. I suppose that the "power" output of the function corresponds to conduction losses. Please advice me otherwise. If the "power" provides the total losses. The provided link of the ee_getPowerLossSummary, it says that the function is capable of estimating both conduction and switching losses for the above devices. Also, highlights that the reverse recovery loss can also be obtained.
However, when I run the simulation and run the function ee_GetPowerLossSummary afterwards, It only provides the conduction losses of the diode. Always, the diode losses are given as zero. It provides the conduction and switching losses for the IGBT. I have modeled the diode for reverse recovery operation by adding values from the datasheet. I was wondering whether there are any additional options to configure to get this to work. Also, I can see that the switching losses of the IGBTs fall drastically when a deadtime is used between High and Low switches in a same leg. When deadtime is not used, a signficant amount of switching losses are present. These observations have been made using the aforementioned ee_getPowerLossSummary function and as well as post processing the instantaneuos power waveforms obtained through power sensors. I don’t understand this since switching losses apply even when the deadtime is used since it only happens due to the IGBT’s own voltage and current. Not by the temporary shootthrough that happens if deadtime is not used.
Any suggestion, comment or advice regarding this process is highly appreciated. Thank you. simulink, dab, loss, igbt, diode, switching losses, reverse recovery losses MATLAB Answers — New Questions
NXP S32k1xx Toolbox installation
Hi everyone,
I’m trying to install nxp toolbox but getting given below error kindly help me out.
Dot indexing is not supported for variables of this type.
Error in NXP_Support_Package_S32K1xx>ConvertToolbox_Callback (line 143)
user_selection = get(handles.mbdt_version,’Value’);
^^^^^^^^^^^^^^^^^^^^
Error in gui_mainfcn (line 95)
feval(varargin{:});
^^^^^^^^^^^^^^^^^^
Error in NXP_Support_Package_S32K1xx (line 34)
gui_mainfcn(gui_State, varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)NXP_Support_Package_S32K1xx(‘ConvertToolbox_Callback’,hObject,eventdata,guidata(hObject))
Error using matlab.ui.internal.controller.uicontrol.UIControlController/triggerActionEvent (line 76)
Error while evaluating UIControl Callback.
regards,
Durgaprasad BHi everyone,
I’m trying to install nxp toolbox but getting given below error kindly help me out.
Dot indexing is not supported for variables of this type.
Error in NXP_Support_Package_S32K1xx>ConvertToolbox_Callback (line 143)
user_selection = get(handles.mbdt_version,’Value’);
^^^^^^^^^^^^^^^^^^^^
Error in gui_mainfcn (line 95)
feval(varargin{:});
^^^^^^^^^^^^^^^^^^
Error in NXP_Support_Package_S32K1xx (line 34)
gui_mainfcn(gui_State, varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)NXP_Support_Package_S32K1xx(‘ConvertToolbox_Callback’,hObject,eventdata,guidata(hObject))
Error using matlab.ui.internal.controller.uicontrol.UIControlController/triggerActionEvent (line 76)
Error while evaluating UIControl Callback.
regards,
Durgaprasad B Hi everyone,
I’m trying to install nxp toolbox but getting given below error kindly help me out.
Dot indexing is not supported for variables of this type.
Error in NXP_Support_Package_S32K1xx>ConvertToolbox_Callback (line 143)
user_selection = get(handles.mbdt_version,’Value’);
^^^^^^^^^^^^^^^^^^^^
Error in gui_mainfcn (line 95)
feval(varargin{:});
^^^^^^^^^^^^^^^^^^
Error in NXP_Support_Package_S32K1xx (line 34)
gui_mainfcn(gui_State, varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)NXP_Support_Package_S32K1xx(‘ConvertToolbox_Callback’,hObject,eventdata,guidata(hObject))
Error using matlab.ui.internal.controller.uicontrol.UIControlController/triggerActionEvent (line 76)
Error while evaluating UIControl Callback.
regards,
Durgaprasad B nxp toolbox MATLAB Answers — New Questions
How can I edit the properties for multiple requirements in the Requirements Editor in MATLAB R2024b?
Consider the requirement set file shown in the figure below, which is open in MATLAB R2024b. When I select multiple requirements, the "Properties" pane is greyed out and I cannot edit the properties for multiple requirements. How can I get around this?Consider the requirement set file shown in the figure below, which is open in MATLAB R2024b. When I select multiple requirements, the "Properties" pane is greyed out and I cannot edit the properties for multiple requirements. How can I get around this? Consider the requirement set file shown in the figure below, which is open in MATLAB R2024b. When I select multiple requirements, the "Properties" pane is greyed out and I cannot edit the properties for multiple requirements. How can I get around this? simulink, requirements, requirements-toolbox MATLAB Answers — New Questions
Help with Plotting the Envelope of a Scatter Plot in MATLAB
Hello everyone,
I’m trying to plot the envelope of a scatter plot in MATLAB. However, when I use the envelope function, it returns the same plot without highlighting the upper or lower bounds.
This plot was created using a scatter plot, and when I attempt to filter it to retain only the extremum values, I end up with just a single slice of the data.
Has anyone encountered a similar issue or knows how I could extract and plot the envelope correctly (in red), as shown in the reference image?
Thanks in advance!Hello everyone,
I’m trying to plot the envelope of a scatter plot in MATLAB. However, when I use the envelope function, it returns the same plot without highlighting the upper or lower bounds.
This plot was created using a scatter plot, and when I attempt to filter it to retain only the extremum values, I end up with just a single slice of the data.
Has anyone encountered a similar issue or knows how I could extract and plot the envelope correctly (in red), as shown in the reference image?
Thanks in advance! Hello everyone,
I’m trying to plot the envelope of a scatter plot in MATLAB. However, when I use the envelope function, it returns the same plot without highlighting the upper or lower bounds.
This plot was created using a scatter plot, and when I attempt to filter it to retain only the extremum values, I end up with just a single slice of the data.
Has anyone encountered a similar issue or knows how I could extract and plot the envelope correctly (in red), as shown in the reference image?
Thanks in advance! scatter, enveloppe, filtering MATLAB Answers — New Questions
I AM TRYING TO CONTROL SYNCHRONOUS RELUCTANCE MOTOR USING FOC. (Rs) = 8 Ω, (Ld) = 1.2 H (Lq) = 0.1 H P= 2, (J) = 0.125 kg·m² , (B) = 0.009 IF THE SIMULATION DIAGRAM IS OK
Post Content Post Content synchronous reluctance motor using foc MATLAB Answers — New Questions
Error when applying coder to WLAN Toolbox example code
An error occurs when using Matlab coder with hWLANPacketDetector.m used in SDRBeaconReceiverExample.mlx.An error occurs when using Matlab coder with hWLANPacketDetector.m used in SDRBeaconReceiverExample.mlx. An error occurs when using Matlab coder with hWLANPacketDetector.m used in SDRBeaconReceiverExample.mlx. wlan coder MATLAB Answers — New Questions
Please guide me, I can’t find the F280049 Flash file, on TMS320F280049 when using Uniflash it will only work once, after reset it won’t work.
Please guide me, I can’t find the F280049 Flash file, on TMS320F280049 when using Uniflash it will only work once, after reset it won’t work. After reset, it might be from the MCU boosting from RAM?Please guide me, I can’t find the F280049 Flash file, on TMS320F280049 when using Uniflash it will only work once, after reset it won’t work. After reset, it might be from the MCU boosting from RAM? Please guide me, I can’t find the F280049 Flash file, on TMS320F280049 when using Uniflash it will only work once, after reset it won’t work. After reset, it might be from the MCU boosting from RAM? c2000, simulink MATLAB Answers — New Questions









