Author: PuTI
BodePlot: Plotting straight lines on the Mag and Phase plots. Can access the phase plot, to do so, but not the mag plot
Hi there
I was customising the standard MATLAB Bode plot to make the gridlines, major and minor bold,
change the x and y label size and bold them and also customise the axis.
Then I tried to plot the straight line approximation, but I can only seem to access the phase plot, and not the magnitude plot.
For the two axes, ax(1) and ax(2), I have called them mag_ax and phase_ax.
I can access the other properties fine, but when I tries to add the lines, my code doesn’t recognise the mag_ax.
Any advice greatly appreciated
close all
s = tf(‘s’);
G_1 = tf(1/(0.1*s + 1));
figure(‘WindowState’,’maximized’);
gg = bodeplot(G_1);
title(‘Bode plot of $frac{1}{0.1s+1}$’,…
‘Interpreter’,’latex’,’FontSize’,18,’FontWeight’,’bold’);
gg.Responses.Color = "blue";
gg.Responses.LineWidth = 2;
gg.XLabel.FontWeight = "bold";
% Get the handles of the axes
ax = findobj(gcf,’type’,’axes’);
mag_ax = ax(1);
phase_ax = ax(2);
mag_ax.XLim = [0.1 1000];
mag_ax.YLim= [-60 +60];
phase_ax.XLim = [0.1 1000];
phase_ax.YLim= [-90 +90];
phase_ax.YTick = (-90:45:90);
grid on
grid minor
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.MinorGridLineStyle = ‘-‘;
mag_ax.MinorGridLineStyle = ‘-‘;
phase_ax.MinorGridLineWidth = 0.75;
mag_ax.MinorGridLineWidth = 0.75;
phase_ax.MinorGridAlpha = 0.5;
mag_ax.MinorGridAlpha = 0.5;
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.GridAlpha = 1;
mag_ax.GridAlpha = 1;
mag_ax.YLabel.FontWeight = "bold";
mag_ax.YLabel.FontSize = 12;
phase_ax.YLabel.FontWeight = "bold";
phase_ax.YLabel.FontSize = 12;
for k = 1:length(phase_ax)
xticks(phase_ax(k), [0.1 1 10 100 1000]); % Set desired tick positions
end
for k = 1:length(phase_ax)
phase_ax(k).XTickLabel = arrayfun(@(x) sprintf(‘%.1f’, x), phase_ax(k).XTick, ‘UniformOutput’, false);
end
set(phase_ax,’fontweight’,’bold’)
set(mag_ax,’fontweight’,’bold’)
gg.Responses.Visible = ‘on’;
gg.Responses.Color = ‘blue’;
mag_ax.NextPlot = ‘add’;
line([0.1 10.0],[0 0],’linewidth’,2,’color’,’red’);
line([10.0 1000],[0 -40],’linewidth’,2,’color’,’red’);
phase_ax.NextPlot = ‘add’;
line([0.1 1.0],[0 0],’linewidth’,2,’color’,’red’);
line([1.0 100],[0 -90],’linewidth’,2,’color’,’red’);
line([100 1000],[-90 -90],’linewidth’,2,’color’,’red’);Hi there
I was customising the standard MATLAB Bode plot to make the gridlines, major and minor bold,
change the x and y label size and bold them and also customise the axis.
Then I tried to plot the straight line approximation, but I can only seem to access the phase plot, and not the magnitude plot.
For the two axes, ax(1) and ax(2), I have called them mag_ax and phase_ax.
I can access the other properties fine, but when I tries to add the lines, my code doesn’t recognise the mag_ax.
Any advice greatly appreciated
close all
s = tf(‘s’);
G_1 = tf(1/(0.1*s + 1));
figure(‘WindowState’,’maximized’);
gg = bodeplot(G_1);
title(‘Bode plot of $frac{1}{0.1s+1}$’,…
‘Interpreter’,’latex’,’FontSize’,18,’FontWeight’,’bold’);
gg.Responses.Color = "blue";
gg.Responses.LineWidth = 2;
gg.XLabel.FontWeight = "bold";
% Get the handles of the axes
ax = findobj(gcf,’type’,’axes’);
mag_ax = ax(1);
phase_ax = ax(2);
mag_ax.XLim = [0.1 1000];
mag_ax.YLim= [-60 +60];
phase_ax.XLim = [0.1 1000];
phase_ax.YLim= [-90 +90];
phase_ax.YTick = (-90:45:90);
grid on
grid minor
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.MinorGridLineStyle = ‘-‘;
mag_ax.MinorGridLineStyle = ‘-‘;
phase_ax.MinorGridLineWidth = 0.75;
mag_ax.MinorGridLineWidth = 0.75;
phase_ax.MinorGridAlpha = 0.5;
mag_ax.MinorGridAlpha = 0.5;
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.GridAlpha = 1;
mag_ax.GridAlpha = 1;
mag_ax.YLabel.FontWeight = "bold";
mag_ax.YLabel.FontSize = 12;
phase_ax.YLabel.FontWeight = "bold";
phase_ax.YLabel.FontSize = 12;
for k = 1:length(phase_ax)
xticks(phase_ax(k), [0.1 1 10 100 1000]); % Set desired tick positions
end
for k = 1:length(phase_ax)
phase_ax(k).XTickLabel = arrayfun(@(x) sprintf(‘%.1f’, x), phase_ax(k).XTick, ‘UniformOutput’, false);
end
set(phase_ax,’fontweight’,’bold’)
set(mag_ax,’fontweight’,’bold’)
gg.Responses.Visible = ‘on’;
gg.Responses.Color = ‘blue’;
mag_ax.NextPlot = ‘add’;
line([0.1 10.0],[0 0],’linewidth’,2,’color’,’red’);
line([10.0 1000],[0 -40],’linewidth’,2,’color’,’red’);
phase_ax.NextPlot = ‘add’;
line([0.1 1.0],[0 0],’linewidth’,2,’color’,’red’);
line([1.0 100],[0 -90],’linewidth’,2,’color’,’red’);
line([100 1000],[-90 -90],’linewidth’,2,’color’,’red’); Hi there
I was customising the standard MATLAB Bode plot to make the gridlines, major and minor bold,
change the x and y label size and bold them and also customise the axis.
Then I tried to plot the straight line approximation, but I can only seem to access the phase plot, and not the magnitude plot.
For the two axes, ax(1) and ax(2), I have called them mag_ax and phase_ax.
I can access the other properties fine, but when I tries to add the lines, my code doesn’t recognise the mag_ax.
Any advice greatly appreciated
close all
s = tf(‘s’);
G_1 = tf(1/(0.1*s + 1));
figure(‘WindowState’,’maximized’);
gg = bodeplot(G_1);
title(‘Bode plot of $frac{1}{0.1s+1}$’,…
‘Interpreter’,’latex’,’FontSize’,18,’FontWeight’,’bold’);
gg.Responses.Color = "blue";
gg.Responses.LineWidth = 2;
gg.XLabel.FontWeight = "bold";
% Get the handles of the axes
ax = findobj(gcf,’type’,’axes’);
mag_ax = ax(1);
phase_ax = ax(2);
mag_ax.XLim = [0.1 1000];
mag_ax.YLim= [-60 +60];
phase_ax.XLim = [0.1 1000];
phase_ax.YLim= [-90 +90];
phase_ax.YTick = (-90:45:90);
grid on
grid minor
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.MinorGridLineStyle = ‘-‘;
mag_ax.MinorGridLineStyle = ‘-‘;
phase_ax.MinorGridLineWidth = 0.75;
mag_ax.MinorGridLineWidth = 0.75;
phase_ax.MinorGridAlpha = 0.5;
mag_ax.MinorGridAlpha = 0.5;
phase_ax.GridLineWidth = 1;
mag_ax.GridLineWidth = 1;
phase_ax.GridAlpha = 1;
mag_ax.GridAlpha = 1;
mag_ax.YLabel.FontWeight = "bold";
mag_ax.YLabel.FontSize = 12;
phase_ax.YLabel.FontWeight = "bold";
phase_ax.YLabel.FontSize = 12;
for k = 1:length(phase_ax)
xticks(phase_ax(k), [0.1 1 10 100 1000]); % Set desired tick positions
end
for k = 1:length(phase_ax)
phase_ax(k).XTickLabel = arrayfun(@(x) sprintf(‘%.1f’, x), phase_ax(k).XTick, ‘UniformOutput’, false);
end
set(phase_ax,’fontweight’,’bold’)
set(mag_ax,’fontweight’,’bold’)
gg.Responses.Visible = ‘on’;
gg.Responses.Color = ‘blue’;
mag_ax.NextPlot = ‘add’;
line([0.1 10.0],[0 0],’linewidth’,2,’color’,’red’);
line([10.0 1000],[0 -40],’linewidth’,2,’color’,’red’);
phase_ax.NextPlot = ‘add’;
line([0.1 1.0],[0 0],’linewidth’,2,’color’,’red’);
line([1.0 100],[0 -90],’linewidth’,2,’color’,’red’);
line([100 1000],[-90 -90],’linewidth’,2,’color’,’red’); bodeplot, matlab MATLAB Answers — New Questions
How can I verify that the roll-off factors (0.15, 0.10, and 0.05) are correctly implemented in the dvbs2xWaveformGenerator function?
What is the correct way to validate the roll-off factor (0.15, 0.10, 0.05) used by the dvbs2xWaveformGenerator in MATLAB? Is there a way to confirm it from the generated waveform?What is the correct way to validate the roll-off factor (0.15, 0.10, 0.05) used by the dvbs2xWaveformGenerator in MATLAB? Is there a way to confirm it from the generated waveform? What is the correct way to validate the roll-off factor (0.15, 0.10, 0.05) used by the dvbs2xWaveformGenerator in MATLAB? Is there a way to confirm it from the generated waveform? dvb-s2x, signal-processing, communication-toolbox, roll-off, satellite communications toolbox, wireless communications toolbox MATLAB Answers — New Questions
Drawing planes in geology
Dear all
I need help to add an algoritm or modified the exsit one to get the figures annexed in file:the following is my code:
clc; clear; close all;
%% —————- 1. Load Data ————————————
filename = ‘ThreeFaultModel_Modified.xlsx’;
data = xlsread(filename);
x = data(:,1);
g_Bouguer = data(:,2);
x = x(:); g_Bouguer = g_Bouguer(:);
%% —————- 2. User Inputs ———————————
N_layers = input(‘Enter number of layers: ‘);
rho_profiles = zeros(1, N_layers);
for i = 1:N_layers
rho_profiles(i) = input([‘Density of layer ‘ num2str(i) ‘: ‘]);
end
rho_basement = input(‘Basement density: ‘);
rho_contrasts = rho_profiles – rho_basement;
%% —————- 3. Inversion ————————
G = 6.67e-3;
z_inv = bsxfun(@rdivide, g_Bouguer, (2*pi*G*rho_contrasts));
%% —————- 4. Detect ONE Main Fault ————————
VG = gradient(z_inv(:,1), x);
% اختيار أقوى تغير (fault)
[~, idx_fault] = max(abs(VG));
MainFault.x = x(idx_fault);
MainFault.dip = atan2d(VG(idx_fault),1); % تقدير تقريبي
MainFault.throw = max(z_inv(:,1)) * 0.3; % تقدير بسيط
MainFault.type = ‘Normal’;
if MainFault.dip > 0
MainFault.type = ‘Reverse’;
end
if abs(MainFault.dip) > 85
MainFault.type = ‘Vertical’;
end
%% —————- 5. Apply ONE Fault to All Layers —————-
z_layers = z_inv;
for L = 1:N_layers
if strcmp(MainFault.type,’Reverse’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) + MainFault.throw;
elseif strcmp(MainFault.type,’Normal’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) – MainFault.throw;
else
% Vertical → no vertical shift
end
end
%% —————- 6. Plot Depth ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Depth with Single Fault’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
legend(arrayfun(@(k) sprintf(‘Layer %d’,k),1:N_layers,’UniformOutput’,false));
%% —————- 7. Plot Single Fault Plane ————————
z_max = max(z_layers(:));
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’r–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’r–‘,’LineWidth’,2);
end
%% —————- 8. Dip Line from Surface ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Single Fault Dip Line’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
z1 = max(z_layers(:,1));
dip = MainFault.dip;
x0 = MainFault.x;
if abs(dip) > 89
x1 = x0;
else
x1 = x0 + z1 / tand(dip);
end
plot([x0 x1],[0 z1],’r–‘,’LineWidth’,2);
text((x0+x1)/2,0.3,’Main Fault’,’Color’,’r’);
%% —————- 9. Geological Section ————————
figure; hold on;
colors = lines(N_layers);
for i = N_layers:-1:1
if i == 1
top = zeros(size(x));
else
top = z_layers(:,i-1);
end
bot = z_layers(:,i);
fill([x;flipud(x)], [top;flipud(bot)], colors(i,:), …
‘EdgeColor’,’k’,’FaceAlpha’,0.6);
end
% رسم الصدع
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’k–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’k–‘,’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
title(‘Geological Cross Section with Single Fault’);
legend(arrayfun(@(i) sprintf(‘Layer %d’,i),1:N_layers,’UniformOutput’,false));
we use the following paramters:
Enter number of layers: 3
Density of layer 1: 2.20
Density of layer 2: 2.25
Density of layer 3: 2.30
Basement density: 2.67Dear all
I need help to add an algoritm or modified the exsit one to get the figures annexed in file:the following is my code:
clc; clear; close all;
%% —————- 1. Load Data ————————————
filename = ‘ThreeFaultModel_Modified.xlsx’;
data = xlsread(filename);
x = data(:,1);
g_Bouguer = data(:,2);
x = x(:); g_Bouguer = g_Bouguer(:);
%% —————- 2. User Inputs ———————————
N_layers = input(‘Enter number of layers: ‘);
rho_profiles = zeros(1, N_layers);
for i = 1:N_layers
rho_profiles(i) = input([‘Density of layer ‘ num2str(i) ‘: ‘]);
end
rho_basement = input(‘Basement density: ‘);
rho_contrasts = rho_profiles – rho_basement;
%% —————- 3. Inversion ————————
G = 6.67e-3;
z_inv = bsxfun(@rdivide, g_Bouguer, (2*pi*G*rho_contrasts));
%% —————- 4. Detect ONE Main Fault ————————
VG = gradient(z_inv(:,1), x);
% اختيار أقوى تغير (fault)
[~, idx_fault] = max(abs(VG));
MainFault.x = x(idx_fault);
MainFault.dip = atan2d(VG(idx_fault),1); % تقدير تقريبي
MainFault.throw = max(z_inv(:,1)) * 0.3; % تقدير بسيط
MainFault.type = ‘Normal’;
if MainFault.dip > 0
MainFault.type = ‘Reverse’;
end
if abs(MainFault.dip) > 85
MainFault.type = ‘Vertical’;
end
%% —————- 5. Apply ONE Fault to All Layers —————-
z_layers = z_inv;
for L = 1:N_layers
if strcmp(MainFault.type,’Reverse’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) + MainFault.throw;
elseif strcmp(MainFault.type,’Normal’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) – MainFault.throw;
else
% Vertical → no vertical shift
end
end
%% —————- 6. Plot Depth ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Depth with Single Fault’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
legend(arrayfun(@(k) sprintf(‘Layer %d’,k),1:N_layers,’UniformOutput’,false));
%% —————- 7. Plot Single Fault Plane ————————
z_max = max(z_layers(:));
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’r–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’r–‘,’LineWidth’,2);
end
%% —————- 8. Dip Line from Surface ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Single Fault Dip Line’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
z1 = max(z_layers(:,1));
dip = MainFault.dip;
x0 = MainFault.x;
if abs(dip) > 89
x1 = x0;
else
x1 = x0 + z1 / tand(dip);
end
plot([x0 x1],[0 z1],’r–‘,’LineWidth’,2);
text((x0+x1)/2,0.3,’Main Fault’,’Color’,’r’);
%% —————- 9. Geological Section ————————
figure; hold on;
colors = lines(N_layers);
for i = N_layers:-1:1
if i == 1
top = zeros(size(x));
else
top = z_layers(:,i-1);
end
bot = z_layers(:,i);
fill([x;flipud(x)], [top;flipud(bot)], colors(i,:), …
‘EdgeColor’,’k’,’FaceAlpha’,0.6);
end
% رسم الصدع
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’k–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’k–‘,’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
title(‘Geological Cross Section with Single Fault’);
legend(arrayfun(@(i) sprintf(‘Layer %d’,i),1:N_layers,’UniformOutput’,false));
we use the following paramters:
Enter number of layers: 3
Density of layer 1: 2.20
Density of layer 2: 2.25
Density of layer 3: 2.30
Basement density: 2.67 Dear all
I need help to add an algoritm or modified the exsit one to get the figures annexed in file:the following is my code:
clc; clear; close all;
%% —————- 1. Load Data ————————————
filename = ‘ThreeFaultModel_Modified.xlsx’;
data = xlsread(filename);
x = data(:,1);
g_Bouguer = data(:,2);
x = x(:); g_Bouguer = g_Bouguer(:);
%% —————- 2. User Inputs ———————————
N_layers = input(‘Enter number of layers: ‘);
rho_profiles = zeros(1, N_layers);
for i = 1:N_layers
rho_profiles(i) = input([‘Density of layer ‘ num2str(i) ‘: ‘]);
end
rho_basement = input(‘Basement density: ‘);
rho_contrasts = rho_profiles – rho_basement;
%% —————- 3. Inversion ————————
G = 6.67e-3;
z_inv = bsxfun(@rdivide, g_Bouguer, (2*pi*G*rho_contrasts));
%% —————- 4. Detect ONE Main Fault ————————
VG = gradient(z_inv(:,1), x);
% اختيار أقوى تغير (fault)
[~, idx_fault] = max(abs(VG));
MainFault.x = x(idx_fault);
MainFault.dip = atan2d(VG(idx_fault),1); % تقدير تقريبي
MainFault.throw = max(z_inv(:,1)) * 0.3; % تقدير بسيط
MainFault.type = ‘Normal’;
if MainFault.dip > 0
MainFault.type = ‘Reverse’;
end
if abs(MainFault.dip) > 85
MainFault.type = ‘Vertical’;
end
%% —————- 5. Apply ONE Fault to All Layers —————-
z_layers = z_inv;
for L = 1:N_layers
if strcmp(MainFault.type,’Reverse’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) + MainFault.throw;
elseif strcmp(MainFault.type,’Normal’)
z_layers(idx_fault:end, L:end) = z_layers(idx_fault:end, L:end) – MainFault.throw;
else
% Vertical → no vertical shift
end
end
%% —————- 6. Plot Depth ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Depth with Single Fault’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
legend(arrayfun(@(k) sprintf(‘Layer %d’,k),1:N_layers,’UniformOutput’,false));
%% —————- 7. Plot Single Fault Plane ————————
z_max = max(z_layers(:));
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’r–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’r–‘,’LineWidth’,2);
end
%% —————- 8. Dip Line from Surface ————————
figure; hold on;
for i = 1:N_layers
plot(x, z_layers(:,i),’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
grid on;
title(‘Single Fault Dip Line’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
z1 = max(z_layers(:,1));
dip = MainFault.dip;
x0 = MainFault.x;
if abs(dip) > 89
x1 = x0;
else
x1 = x0 + z1 / tand(dip);
end
plot([x0 x1],[0 z1],’r–‘,’LineWidth’,2);
text((x0+x1)/2,0.3,’Main Fault’,’Color’,’r’);
%% —————- 9. Geological Section ————————
figure; hold on;
colors = lines(N_layers);
for i = N_layers:-1:1
if i == 1
top = zeros(size(x));
else
top = z_layers(:,i-1);
end
bot = z_layers(:,i);
fill([x;flipud(x)], [top;flipud(bot)], colors(i,:), …
‘EdgeColor’,’k’,’FaceAlpha’,0.6);
end
% رسم الصدع
if strcmp(MainFault.type,’Vertical’)
plot([MainFault.x MainFault.x],[0 z_max],’k–‘,’LineWidth’,2);
else
dx = z_max / tand(MainFault.dip);
if MainFault.dip > 0
x2 = MainFault.x – dx;
else
x2 = MainFault.x + dx;
end
plot([MainFault.x x2],[0 z_max],’k–‘,’LineWidth’,2);
end
set(gca,’YDir’,’reverse’);
xlabel(‘Distance (km)’);
ylabel(‘Depth (km)’);
title(‘Geological Cross Section with Single Fault’);
legend(arrayfun(@(i) sprintf(‘Layer %d’,i),1:N_layers,’UniformOutput’,false));
we use the following paramters:
Enter number of layers: 3
Density of layer 1: 2.20
Density of layer 2: 2.25
Density of layer 3: 2.30
Basement density: 2.67 matlab, drawing, plane MATLAB Answers — New Questions
Comparing one 3D point cloud with a selection of collected 3D point clouds?
Hello,
I am relatively new to MATLAB and coding. I am working on a project in which I hope to compare the point cloud of an individual CT scan to a collection of CT scans of the same structure. I would like to be able to receive a "closest-match" output. Basically: You put your scan in, its compared to the existing scans and you are provided with statistical and visual data on which existing scans match the closest.
I am currently in the planning phase for this project and am trying to identify which steps to take and which tools to consider, as well as to see if there i already existing code that can help me. I would really appreciate some ideas, related content or tips, as well as some questions I should ask myself and consider on how to achieve the first steps of this project, which would be to get a comparison going.
I appreciate all the help and pointing in the right direction I can get.
Thanks,
AnileHello,
I am relatively new to MATLAB and coding. I am working on a project in which I hope to compare the point cloud of an individual CT scan to a collection of CT scans of the same structure. I would like to be able to receive a "closest-match" output. Basically: You put your scan in, its compared to the existing scans and you are provided with statistical and visual data on which existing scans match the closest.
I am currently in the planning phase for this project and am trying to identify which steps to take and which tools to consider, as well as to see if there i already existing code that can help me. I would really appreciate some ideas, related content or tips, as well as some questions I should ask myself and consider on how to achieve the first steps of this project, which would be to get a comparison going.
I appreciate all the help and pointing in the right direction I can get.
Thanks,
Anile Hello,
I am relatively new to MATLAB and coding. I am working on a project in which I hope to compare the point cloud of an individual CT scan to a collection of CT scans of the same structure. I would like to be able to receive a "closest-match" output. Basically: You put your scan in, its compared to the existing scans and you are provided with statistical and visual data on which existing scans match the closest.
I am currently in the planning phase for this project and am trying to identify which steps to take and which tools to consider, as well as to see if there i already existing code that can help me. I would really appreciate some ideas, related content or tips, as well as some questions I should ask myself and consider on how to achieve the first steps of this project, which would be to get a comparison going.
I appreciate all the help and pointing in the right direction I can get.
Thanks,
Anile point cloud, image comparison, point set matching MATLAB Answers — New Questions
Disable reset of Jacobian
I’m trying to switch from the old “black” Simcape Specialized Power System library to the new “blue” Simcape library. I’m using the phasor solution and the fast calculation method, but the problem lies with the phasor solver itself. The solver resets the Jacobian matrix much more frequently than the Specilaized Power library solver. Any tips on how to reduce the frequency of these resets?
See attached report from Simulink Profiler:I’m trying to switch from the old “black” Simcape Specialized Power System library to the new “blue” Simcape library. I’m using the phasor solution and the fast calculation method, but the problem lies with the phasor solver itself. The solver resets the Jacobian matrix much more frequently than the Specilaized Power library solver. Any tips on how to reduce the frequency of these resets?
See attached report from Simulink Profiler: I’m trying to switch from the old “black” Simcape Specialized Power System library to the new “blue” Simcape library. I’m using the phasor solution and the fast calculation method, but the problem lies with the phasor solver itself. The solver resets the Jacobian matrix much more frequently than the Specilaized Power library solver. Any tips on how to reduce the frequency of these resets?
See attached report from Simulink Profiler: reset, jacobian MATLAB Answers — New Questions
UAV code simulation not showing the output properly
I am working on project on UAV. MATLAB code is working fine, but generated output does not show any UAVs. I can share some code here if someone is interested.I am working on project on UAV. MATLAB code is working fine, but generated output does not show any UAVs. I can share some code here if someone is interested. I am working on project on UAV. MATLAB code is working fine, but generated output does not show any UAVs. I can share some code here if someone is interested. aerial vehicle MATLAB Answers — New Questions
Integrating MMC in IEEE 9 bus system
Hello to fellow MATLAB users. I am studying electrical engineering and not so familiar with MATLAB and Simulink. Therefore I need your help.
I want to integrate a MMC system into IEEE 9 bus system to study how fault current behaves when an AC transmission line is replaced with a HVDC link. More specifically I want to integrate simscapeelectrical/ModularMultilevelConverterHVDCTransExample between bus 4 and bus 6 in simscapeelectrical/IEEE9BusSystemExample. However, I am at a dead end right now, no matter what I try I can’t get it right. I’d appreciate if you could guide me on how to tackle this problem.Hello to fellow MATLAB users. I am studying electrical engineering and not so familiar with MATLAB and Simulink. Therefore I need your help.
I want to integrate a MMC system into IEEE 9 bus system to study how fault current behaves when an AC transmission line is replaced with a HVDC link. More specifically I want to integrate simscapeelectrical/ModularMultilevelConverterHVDCTransExample between bus 4 and bus 6 in simscapeelectrical/IEEE9BusSystemExample. However, I am at a dead end right now, no matter what I try I can’t get it right. I’d appreciate if you could guide me on how to tackle this problem. Hello to fellow MATLAB users. I am studying electrical engineering and not so familiar with MATLAB and Simulink. Therefore I need your help.
I want to integrate a MMC system into IEEE 9 bus system to study how fault current behaves when an AC transmission line is replaced with a HVDC link. More specifically I want to integrate simscapeelectrical/ModularMultilevelConverterHVDCTransExample between bus 4 and bus 6 in simscapeelectrical/IEEE9BusSystemExample. However, I am at a dead end right now, no matter what I try I can’t get it right. I’d appreciate if you could guide me on how to tackle this problem. mmc, hvdc, ieee 9 bus, ac transmission MATLAB Answers — New Questions
Please help me to run this simple relation
I want to draw relation between T ( y-axis) and x ( x-axis) with change parameter B1.
Constant:
B2=0.01;B4=0.1;
vector
Parameter
B1=0.1:0.1:0.5I want to draw relation between T ( y-axis) and x ( x-axis) with change parameter B1.
Constant:
B2=0.01;B4=0.1;
vector
Parameter
B1=0.1:0.1:0.5 I want to draw relation between T ( y-axis) and x ( x-axis) with change parameter B1.
Constant:
B2=0.01;B4=0.1;
vector
Parameter
B1=0.1:0.1:0.5 plot MATLAB Answers — New Questions
Finding all eigen value between two given eigen value.
Suppose there are two square symmetric matrices [K] and [M]. Since my work is related with structural analysis so they are typically stiffness and mass matrices. I am doing wave propagation study for a narrow band input load. In frequency domain, load amplitude is significant only between frequency [omega1 omega2]. So I am interested to find all eigen value and corresponding eigen vector only in this range.
The eigen value problem statement is
[K]=lambda[M]Suppose there are two square symmetric matrices [K] and [M]. Since my work is related with structural analysis so they are typically stiffness and mass matrices. I am doing wave propagation study for a narrow band input load. In frequency domain, load amplitude is significant only between frequency [omega1 omega2]. So I am interested to find all eigen value and corresponding eigen vector only in this range.
The eigen value problem statement is
[K]=lambda[M] Suppose there are two square symmetric matrices [K] and [M]. Since my work is related with structural analysis so they are typically stiffness and mass matrices. I am doing wave propagation study for a narrow band input load. In frequency domain, load amplitude is significant only between frequency [omega1 omega2]. So I am interested to find all eigen value and corresponding eigen vector only in this range.
The eigen value problem statement is
[K]=lambda[M] all eigen value between given range MATLAB Answers — New Questions
2026a Release Date?
Good morning,
does someone know when full 2026a will be released? Normal release month is March, I did not see or hear something about a planned delayed release. Would be nice to use a more stable version than 2025a for app buiding (pls don’t tell me to use 2025b)…
greetingsGood morning,
does someone know when full 2026a will be released? Normal release month is March, I did not see or hear something about a planned delayed release. Would be nice to use a more stable version than 2025a for app buiding (pls don’t tell me to use 2025b)…
greetings Good morning,
does someone know when full 2026a will be released? Normal release month is March, I did not see or hear something about a planned delayed release. Would be nice to use a more stable version than 2025a for app buiding (pls don’t tell me to use 2025b)…
greetings release MATLAB Answers — New Questions
How should I handle streaming inputs and outputs for my Simulink Compiler model (TCP/UDP, visualization, disp, S-function, C Caller, etc.)?
I have a model that I plan on deploying with Simulink Compiler. I would like to stream the inputs and outputs to the model, for example:Stream inputs/outputs with TCP/UDPPublish subscribe with ROS OPC client-server communicationRead from or write to a file or databaseStream to a live output visualization
I tried putting the input and output handling inside the model itself, with specific I/O blocks however I ran into problems with blocks not being supported for Rapid Accelerator mode. What is the recommended method to do this?I have a model that I plan on deploying with Simulink Compiler. I would like to stream the inputs and outputs to the model, for example:Stream inputs/outputs with TCP/UDPPublish subscribe with ROS OPC client-server communicationRead from or write to a file or databaseStream to a live output visualization
I tried putting the input and output handling inside the model itself, with specific I/O blocks however I ran into problems with blocks not being supported for Rapid Accelerator mode. What is the recommended method to do this? I have a model that I plan on deploying with Simulink Compiler. I would like to stream the inputs and outputs to the model, for example:Stream inputs/outputs with TCP/UDPPublish subscribe with ROS OPC client-server communicationRead from or write to a file or databaseStream to a live output visualization
I tried putting the input and output handling inside the model itself, with specific I/O blocks however I ran into problems with blocks not being supported for Rapid Accelerator mode. What is the recommended method to do this? simulinkcompiler, deployment, simulink, compiler, io MATLAB Answers — New Questions
Unable to create ROS2 node
I am trying to create a ROS2 node on Windows 11, MATLAB R2025b.
While either trying to create a node, or even testing with "ros2 node list", I receive an error:
>> node = ros2node("matlab_node");
Error using ros2node/createNode (line 552)
Error creating the ROS 2 node matlab_node.
Error in
ros2node (line 166)
createNode(obj, parser.Results.name, parser.Results.id);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Caused by:
Error using
ros.internal.Node/create
Server failed to start. Details: Transport stopped.
This was working hours ago…
reinstalling ROS toolbox and even MATLAB did not change outcome.
Thanks!I am trying to create a ROS2 node on Windows 11, MATLAB R2025b.
While either trying to create a node, or even testing with "ros2 node list", I receive an error:
>> node = ros2node("matlab_node");
Error using ros2node/createNode (line 552)
Error creating the ROS 2 node matlab_node.
Error in
ros2node (line 166)
createNode(obj, parser.Results.name, parser.Results.id);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Caused by:
Error using
ros.internal.Node/create
Server failed to start. Details: Transport stopped.
This was working hours ago…
reinstalling ROS toolbox and even MATLAB did not change outcome.
Thanks! I am trying to create a ROS2 node on Windows 11, MATLAB R2025b.
While either trying to create a node, or even testing with "ros2 node list", I receive an error:
>> node = ros2node("matlab_node");
Error using ros2node/createNode (line 552)
Error creating the ROS 2 node matlab_node.
Error in
ros2node (line 166)
createNode(obj, parser.Results.name, parser.Results.id);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Caused by:
Error using
ros.internal.Node/create
Server failed to start. Details: Transport stopped.
This was working hours ago…
reinstalling ROS toolbox and even MATLAB did not change outcome.
Thanks! ros2 node list, ros2node MATLAB Answers — New Questions
How to add a shared ylabel on the right hand-side of a figure, when combining tiledlayout and yyaxis?
In addition to a shared ylabel on the left hand-side of a figure, I want to put a shared ylabel on the right hand-side of the tiledlayout, when also using yyaxis. How can I achieve this? I have prepared the following MWE:
figure
t = tiledlayout(4,1);
for i = 1:4
nexttile
title("Tile"+i)
yyaxis left
plot(rand(1,10))
yyaxis right
plot(rand(1,10))
end
title(t,"Tiles")
xlabel(t,"x")
ylabel(t,"y left")
% ylabel(t,"y right")
Thanks in advance!
Edit:
My yticklabels on the left as well as on the right hand-side are relatively long, therefore, both shared ylabels need to factor the necessary distance in. The shared ylabel on the left hand-side does this automatically, the one on the right hand-side should do the same. I have updated the MWE (unfortunately, it now acts a bit buggy but it should illustrate the point, nonetheless):
figure
t = tiledlayout(4,1);
longYTickLabels_left = ["negative yticklabel left" "0" "positive yticklabel left" ];%edit: added
longYTickLabels_right = ["negative yticklabel right" "0" "positive yticklabel right"];%edit: added
for i = 1:4
nexttile
title("Tile"+i)
yyaxis left
plot(rand(1,10))
yticklabels(longYTickLabels_left)%edit: added
yyaxis right
plot(rand(1,10))
yticklabels(longYTickLabels_right)%edit: added
end
title(t,"Tiles")
xlabel(t,"x")
ylabel(t,"y left")
% ylabel(t,"y right")In addition to a shared ylabel on the left hand-side of a figure, I want to put a shared ylabel on the right hand-side of the tiledlayout, when also using yyaxis. How can I achieve this? I have prepared the following MWE:
figure
t = tiledlayout(4,1);
for i = 1:4
nexttile
title("Tile"+i)
yyaxis left
plot(rand(1,10))
yyaxis right
plot(rand(1,10))
end
title(t,"Tiles")
xlabel(t,"x")
ylabel(t,"y left")
% ylabel(t,"y right")
Thanks in advance!
Edit:
My yticklabels on the left as well as on the right hand-side are relatively long, therefore, both shared ylabels need to factor the necessary distance in. The shared ylabel on the left hand-side does this automatically, the one on the right hand-side should do the same. I have updated the MWE (unfortunately, it now acts a bit buggy but it should illustrate the point, nonetheless):
figure
t = tiledlayout(4,1);
longYTickLabels_left = ["negative yticklabel left" "0" "positive yticklabel left" ];%edit: added
longYTickLabels_right = ["negative yticklabel right" "0" "positive yticklabel right"];%edit: added
for i = 1:4
nexttile
title("Tile"+i)
yyaxis left
plot(rand(1,10))
yticklabels(longYTickLabels_left)%edit: added
yyaxis right
plot(rand(1,10))
yticklabels(longYTickLabels_right)%edit: added
end
title(t,"Tiles")
xlabel(t,"x")
ylabel(t,"y left")
% ylabel(t,"y right") In addition to a shared ylabel on the left hand-side of a figure, I want to put a shared ylabel on the right hand-side of the tiledlayout, when also using yyaxis. How can I achieve this? I have prepared the following MWE:
figure
t = tiledlayout(4,1);
for i = 1:4
nexttile
title("Tile"+i)
yyaxis left
plot(rand(1,10))
yyaxis right
plot(rand(1,10))
end
title(t,"Tiles")
xlabel(t,"x")
ylabel(t,"y left")
% ylabel(t,"y right")
Thanks in advance!
Edit:
My yticklabels on the left as well as on the right hand-side are relatively long, therefore, both shared ylabels need to factor the necessary distance in. The shared ylabel on the left hand-side does this automatically, the one on the right hand-side should do the same. I have updated the MWE (unfortunately, it now acts a bit buggy but it should illustrate the point, nonetheless):
figure
t = tiledlayout(4,1);
longYTickLabels_left = ["negative yticklabel left" "0" "positive yticklabel left" ];%edit: added
longYTickLabels_right = ["negative yticklabel right" "0" "positive yticklabel right"];%edit: added
for i = 1:4
nexttile
title("Tile"+i)
yyaxis left
plot(rand(1,10))
yticklabels(longYTickLabels_left)%edit: added
yyaxis right
plot(rand(1,10))
yticklabels(longYTickLabels_right)%edit: added
end
title(t,"Tiles")
xlabel(t,"x")
ylabel(t,"y left")
% ylabel(t,"y right") tiledlayout, yyaxis, ylabel, figure MATLAB Answers — New Questions
Bidirectional DC-DC Converter crashes during mode transition (charging to discharging) due to infinite di/dt
Hi everyone,
I am building a microgrid model in Simulink and I am hitting a brick wall during a specific weather transient event.
The Setup:
I have a 48V battery connected to a 200V DC Bus via a Bidirectional DC-DC Converter.
The DC Bus has a constant 1500W load, supported by Wind and Solar sources.
The converter uses cascaded PI controllers (Outer Voltage Loop, Inner Current Loop) to generate a PWM duty cycle via a Relational Operator and Triangle Wave (10 kHz).
The powergui is set to Discrete with a sample time of 1e-5.
The Problem:For the first 14.9 seconds, the Wind and Solar easily supply the load, and the excess power is pushed into the battery. The battery is charging (current is flowing in reverse).
At exactly t = 15.0 seconds, the wind and solar drop. The battery must instantly reverse current flow to discharge and support the 1500W load. At this exact millisecond, the simulation aborts. Scopes show a massive, instantaneous current spike as the current tries to reverse direction, causing the math solver to fail.
What I Have Already Tried:
Swapped to modern Discrete PID blocks with Anti-Windup (Clamping) to prevent integrator explosion.
Lowered the PI gains significantly to stop the controller from aggressively overreacting.
Disabled zero-crossing detection on the PID blocks.
Capped the maximum Duty Cycle at 0.85 to prevent infinite voltage commands.
I have attached a screenshot of my control loop and the scope showing the crash at 15.0s. Any advice or guidance on power electronics best practices in Simulink would be greatly appreciated!Hi everyone,
I am building a microgrid model in Simulink and I am hitting a brick wall during a specific weather transient event.
The Setup:
I have a 48V battery connected to a 200V DC Bus via a Bidirectional DC-DC Converter.
The DC Bus has a constant 1500W load, supported by Wind and Solar sources.
The converter uses cascaded PI controllers (Outer Voltage Loop, Inner Current Loop) to generate a PWM duty cycle via a Relational Operator and Triangle Wave (10 kHz).
The powergui is set to Discrete with a sample time of 1e-5.
The Problem:For the first 14.9 seconds, the Wind and Solar easily supply the load, and the excess power is pushed into the battery. The battery is charging (current is flowing in reverse).
At exactly t = 15.0 seconds, the wind and solar drop. The battery must instantly reverse current flow to discharge and support the 1500W load. At this exact millisecond, the simulation aborts. Scopes show a massive, instantaneous current spike as the current tries to reverse direction, causing the math solver to fail.
What I Have Already Tried:
Swapped to modern Discrete PID blocks with Anti-Windup (Clamping) to prevent integrator explosion.
Lowered the PI gains significantly to stop the controller from aggressively overreacting.
Disabled zero-crossing detection on the PID blocks.
Capped the maximum Duty Cycle at 0.85 to prevent infinite voltage commands.
I have attached a screenshot of my control loop and the scope showing the crash at 15.0s. Any advice or guidance on power electronics best practices in Simulink would be greatly appreciated! Hi everyone,
I am building a microgrid model in Simulink and I am hitting a brick wall during a specific weather transient event.
The Setup:
I have a 48V battery connected to a 200V DC Bus via a Bidirectional DC-DC Converter.
The DC Bus has a constant 1500W load, supported by Wind and Solar sources.
The converter uses cascaded PI controllers (Outer Voltage Loop, Inner Current Loop) to generate a PWM duty cycle via a Relational Operator and Triangle Wave (10 kHz).
The powergui is set to Discrete with a sample time of 1e-5.
The Problem:For the first 14.9 seconds, the Wind and Solar easily supply the load, and the excess power is pushed into the battery. The battery is charging (current is flowing in reverse).
At exactly t = 15.0 seconds, the wind and solar drop. The battery must instantly reverse current flow to discharge and support the 1500W load. At this exact millisecond, the simulation aborts. Scopes show a massive, instantaneous current spike as the current tries to reverse direction, causing the math solver to fail.
What I Have Already Tried:
Swapped to modern Discrete PID blocks with Anti-Windup (Clamping) to prevent integrator explosion.
Lowered the PI gains significantly to stop the controller from aggressively overreacting.
Disabled zero-crossing detection on the PID blocks.
Capped the maximum Duty Cycle at 0.85 to prevent infinite voltage commands.
I have attached a screenshot of my control loop and the scope showing the crash at 15.0s. Any advice or guidance on power electronics best practices in Simulink would be greatly appreciated! dc, inverter, crash MATLAB Answers — New Questions
Want to know the output format of audioread of .wav file captured by hydrophone
Geospectrum M36-600 with porpoise datalogger was used to capture noise. The code and respective output are given below. I want to know what is the output format of audioread? Is it normalized or volts or Pa?
CODE:
info = audioinfo(‘D:NIOTDSMmatlab codeNoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’);
disp(info)
[y,Fs] = audioread(‘D:NIOTDSMmatlab codeNoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’); % default: scaled floating-point
[yN,FsN] = audioread(‘D:NIOTDSMmatlab codeNoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’,"native"); % native format when available
class(y)
min(y)
max(y)
OUTPUT:
class(yN)NoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’
CompressionMethod: ‘Uncompressed’
NumChannels: 1
SampleRate: 32000
TotalSamples: 129024
Duration: 4.0320
Title: []
Comment: []
Artist: []
BitsPerSample: 16
ans = ‘double’
ans = -1.5259e-04
ans = 1.5259e-04
ans = ‘int16’Geospectrum M36-600 with porpoise datalogger was used to capture noise. The code and respective output are given below. I want to know what is the output format of audioread? Is it normalized or volts or Pa?
CODE:
info = audioinfo(‘D:NIOTDSMmatlab codeNoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’);
disp(info)
[y,Fs] = audioread(‘D:NIOTDSMmatlab codeNoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’); % default: scaled floating-point
[yN,FsN] = audioread(‘D:NIOTDSMmatlab codeNoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’,"native"); % native format when available
class(y)
min(y)
max(y)
OUTPUT:
class(yN)NoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’
CompressionMethod: ‘Uncompressed’
NumChannels: 1
SampleRate: 32000
TotalSamples: 129024
Duration: 4.0320
Title: []
Comment: []
Artist: []
BitsPerSample: 16
ans = ‘double’
ans = -1.5259e-04
ans = 1.5259e-04
ans = ‘int16’ Geospectrum M36-600 with porpoise datalogger was used to capture noise. The code and respective output are given below. I want to know what is the output format of audioread? Is it normalized or volts or Pa?
CODE:
info = audioinfo(‘D:NIOTDSMmatlab codeNoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’);
disp(info)
[y,Fs] = audioread(‘D:NIOTDSMmatlab codeNoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’); % default: scaled floating-point
[yN,FsN] = audioread(‘D:NIOTDSMmatlab codeNoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’,"native"); % native format when available
class(y)
min(y)
max(y)
OUTPUT:
class(yN)NoiseMatlab PC4.06.2025 HydrophoneVFDNear Motor20250604154138 199-203s.wav’
CompressionMethod: ‘Uncompressed’
NumChannels: 1
SampleRate: 32000
TotalSamples: 129024
Duration: 4.0320
Title: []
Comment: []
Artist: []
BitsPerSample: 16
ans = ‘double’
ans = -1.5259e-04
ans = 1.5259e-04
ans = ‘int16’ audioread, hydrophone, porpoisedatalogger MATLAB Answers — New Questions
How to correct the grouping variables in splitapply ?
Hi
Kindly see my attached function. It is a callback function for a switch button
I have already converted both my grouping variables to categorical arrrays, still I am getting the message saying: "A grouping variable must be a vector."
I dont understand what more can be and should be done to the grouping variables.
value = app.Switch.Value;
if strcmpi(value, ‘on’)
weightpercentages = [app.Callingapp.Osmotisk_data.Weight_percent_best_salt_1 app.Callingapp.Osmotisk_data.Weight_percent_best_salt_2];
weightpercentages=categorical(weightpercentages);
Combo=categorical(app.Callingapp.Osmotisk_data.Combinations_of_salts);
[g,id1,id2]=findgroups(Combo, weightpercentages);
hold(app.UIAxes, ‘on’)
splitapply(@(x,y)scatter(app.UIAxes,x,y,’filled’),app.temperature,app.Callingapp.Total_water_activity,g)
legend(app.UIAxes,string(id1) + ", "+string(id2) ,’location’,’northwest’)
xlabel(app.UIAxes,’Temperature’), ylabel(app.UIAxes,’Water activity’)
endHi
Kindly see my attached function. It is a callback function for a switch button
I have already converted both my grouping variables to categorical arrrays, still I am getting the message saying: "A grouping variable must be a vector."
I dont understand what more can be and should be done to the grouping variables.
value = app.Switch.Value;
if strcmpi(value, ‘on’)
weightpercentages = [app.Callingapp.Osmotisk_data.Weight_percent_best_salt_1 app.Callingapp.Osmotisk_data.Weight_percent_best_salt_2];
weightpercentages=categorical(weightpercentages);
Combo=categorical(app.Callingapp.Osmotisk_data.Combinations_of_salts);
[g,id1,id2]=findgroups(Combo, weightpercentages);
hold(app.UIAxes, ‘on’)
splitapply(@(x,y)scatter(app.UIAxes,x,y,’filled’),app.temperature,app.Callingapp.Total_water_activity,g)
legend(app.UIAxes,string(id1) + ", "+string(id2) ,’location’,’northwest’)
xlabel(app.UIAxes,’Temperature’), ylabel(app.UIAxes,’Water activity’)
end Hi
Kindly see my attached function. It is a callback function for a switch button
I have already converted both my grouping variables to categorical arrrays, still I am getting the message saying: "A grouping variable must be a vector."
I dont understand what more can be and should be done to the grouping variables.
value = app.Switch.Value;
if strcmpi(value, ‘on’)
weightpercentages = [app.Callingapp.Osmotisk_data.Weight_percent_best_salt_1 app.Callingapp.Osmotisk_data.Weight_percent_best_salt_2];
weightpercentages=categorical(weightpercentages);
Combo=categorical(app.Callingapp.Osmotisk_data.Combinations_of_salts);
[g,id1,id2]=findgroups(Combo, weightpercentages);
hold(app.UIAxes, ‘on’)
splitapply(@(x,y)scatter(app.UIAxes,x,y,’filled’),app.temperature,app.Callingapp.Total_water_activity,g)
legend(app.UIAxes,string(id1) + ", "+string(id2) ,’location’,’northwest’)
xlabel(app.UIAxes,’Temperature’), ylabel(app.UIAxes,’Water activity’)
end splitapply, matlab, groupingvariables MATLAB Answers — New Questions
Deep Learning HDL Workflow “Data size mismatch” after deployment – Possible device tree / AXI DMA configuration issue (ZCU111)
Hello,
I am working with Deep Learning HDL Toolbox on a custom reference design
with the Xilinx ZCU111 RFSoC board. I am able to successfully compile the network,
but I am encountering a deployment error.
Setup: – Board: ZCU111 RFSoC – Interface: PS GEM Ethernet – Reference design:
Custom (based on AXI-Stream DDR Memory Access : 3-AXIM) – Tool versions:
Vivado 2024.1, MATLAB (Deep Learning HDL Toolbox)
Workflow: I compile and deploy the network using: 1. compile(hW) 2.
deploy(hW) 3. predict(…)
Problem: The FPGA is programmed successfully, and the system reboots
correctly: – SSH connection is restored – Ping works
However, during deployment/predict, I get the following error on MATLAB:
Connection to the bitstream is no longer valid caused by error: Data
size mismatch.
Observations: – Bitstream programming is completed successfully – Device
tree is loaded and system boots – The error happens after deployment,
during runtime communication with FPGA.
Device Tree Concern: I suspect that the issue may be related to my device
tree definitions, especially: – dlprocessor IP – AXI stream to
memory-mapped interface (AXIS2AXIM / AXI2SMM) – DMA nodes (MM2S / S2MM)
Possible causes: Incorrect child node definitions
Questions: 1. What are the common causes of “Data size mismatch” in Deep
Learning HDL deployments? 2. Can this error be caused by incorrect
device tree configuration ? 3. Are there specific DTB
requirements for dlprocessor, AXIS2AXIM, and DMA nodes? 4. How can I
verify MATLAB runtime correctly binds to DTB nodes?
Also is there any official or working example of devicetree_dlhdl.dtb for:
Deep Learning HDL Toolbox
AXI-Stream DDR Memory Access (3-AXIM) reference design
ZCU111 (or similar Zynq UltraScale+ platforms)
I am especially interested in correct definitions for:
dlprocessor
AXIS2AXIM / AXI2SMM
DMA nodes (MM2S / S2MM)
mathworks-specific properties (mwipcore, channels, etc.)
If anyone has a working DTB or can point to an example (documentation, repo, or generated output), it would be very helpful.
Thanks!Hello,
I am working with Deep Learning HDL Toolbox on a custom reference design
with the Xilinx ZCU111 RFSoC board. I am able to successfully compile the network,
but I am encountering a deployment error.
Setup: – Board: ZCU111 RFSoC – Interface: PS GEM Ethernet – Reference design:
Custom (based on AXI-Stream DDR Memory Access : 3-AXIM) – Tool versions:
Vivado 2024.1, MATLAB (Deep Learning HDL Toolbox)
Workflow: I compile and deploy the network using: 1. compile(hW) 2.
deploy(hW) 3. predict(…)
Problem: The FPGA is programmed successfully, and the system reboots
correctly: – SSH connection is restored – Ping works
However, during deployment/predict, I get the following error on MATLAB:
Connection to the bitstream is no longer valid caused by error: Data
size mismatch.
Observations: – Bitstream programming is completed successfully – Device
tree is loaded and system boots – The error happens after deployment,
during runtime communication with FPGA.
Device Tree Concern: I suspect that the issue may be related to my device
tree definitions, especially: – dlprocessor IP – AXI stream to
memory-mapped interface (AXIS2AXIM / AXI2SMM) – DMA nodes (MM2S / S2MM)
Possible causes: Incorrect child node definitions
Questions: 1. What are the common causes of “Data size mismatch” in Deep
Learning HDL deployments? 2. Can this error be caused by incorrect
device tree configuration ? 3. Are there specific DTB
requirements for dlprocessor, AXIS2AXIM, and DMA nodes? 4. How can I
verify MATLAB runtime correctly binds to DTB nodes?
Also is there any official or working example of devicetree_dlhdl.dtb for:
Deep Learning HDL Toolbox
AXI-Stream DDR Memory Access (3-AXIM) reference design
ZCU111 (or similar Zynq UltraScale+ platforms)
I am especially interested in correct definitions for:
dlprocessor
AXIS2AXIM / AXI2SMM
DMA nodes (MM2S / S2MM)
mathworks-specific properties (mwipcore, channels, etc.)
If anyone has a working DTB or can point to an example (documentation, repo, or generated output), it would be very helpful.
Thanks! Hello,
I am working with Deep Learning HDL Toolbox on a custom reference design
with the Xilinx ZCU111 RFSoC board. I am able to successfully compile the network,
but I am encountering a deployment error.
Setup: – Board: ZCU111 RFSoC – Interface: PS GEM Ethernet – Reference design:
Custom (based on AXI-Stream DDR Memory Access : 3-AXIM) – Tool versions:
Vivado 2024.1, MATLAB (Deep Learning HDL Toolbox)
Workflow: I compile and deploy the network using: 1. compile(hW) 2.
deploy(hW) 3. predict(…)
Problem: The FPGA is programmed successfully, and the system reboots
correctly: – SSH connection is restored – Ping works
However, during deployment/predict, I get the following error on MATLAB:
Connection to the bitstream is no longer valid caused by error: Data
size mismatch.
Observations: – Bitstream programming is completed successfully – Device
tree is loaded and system boots – The error happens after deployment,
during runtime communication with FPGA.
Device Tree Concern: I suspect that the issue may be related to my device
tree definitions, especially: – dlprocessor IP – AXI stream to
memory-mapped interface (AXIS2AXIM / AXI2SMM) – DMA nodes (MM2S / S2MM)
Possible causes: Incorrect child node definitions
Questions: 1. What are the common causes of “Data size mismatch” in Deep
Learning HDL deployments? 2. Can this error be caused by incorrect
device tree configuration ? 3. Are there specific DTB
requirements for dlprocessor, AXIS2AXIM, and DMA nodes? 4. How can I
verify MATLAB runtime correctly binds to DTB nodes?
Also is there any official or working example of devicetree_dlhdl.dtb for:
Deep Learning HDL Toolbox
AXI-Stream DDR Memory Access (3-AXIM) reference design
ZCU111 (or similar Zynq UltraScale+ platforms)
I am especially interested in correct definitions for:
dlprocessor
AXIS2AXIM / AXI2SMM
DMA nodes (MM2S / S2MM)
mathworks-specific properties (mwipcore, channels, etc.)
If anyone has a working DTB or can point to an example (documentation, repo, or generated output), it would be very helpful.
Thanks! deep learning, cnn, deep learning hdl toolbox, vivado, zcu111 rfsoc board, fpga MATLAB Answers — New Questions
Matlab App Designer Scatterplot
I want to display scatterplot on my axes but when I push the button to display it It displays an error.
also, any suggestions on plotting waveform and phasor of 8-qam
Thank you for any helpI want to display scatterplot on my axes but when I push the button to display it It displays an error.
also, any suggestions on plotting waveform and phasor of 8-qam
Thank you for any help I want to display scatterplot on my axes but when I push the button to display it It displays an error.
also, any suggestions on plotting waveform and phasor of 8-qam
Thank you for any help scattterplot, uiaxes, appdesigner, axes, ui MATLAB Answers — New Questions
Set MATLAB as default for .m files in Ubuntu without opening an empty editor
According to the previous thread, MATLAB can be made to open .m files by default in Ubuntu by editing the matlab.desktop file (usually in /usr/share/applications) and changing:
Exec=matlab -desktop
to
Exec=matlab -desktop -r "edit %f"
https://uk.mathworks.com/matlabcentral/answers/565784-defautl-to-open-m-files-in-matlab-linux
This has the side effect that opening MATLAB from its icon causes an empty editor window to be open. Can anyone advise how to avoid this? It looks like using X-Ayatana-Desktop-Shortcuts may help, but I cannot figure out how to make just opening the command window the default and opening the editor to happen only if a file is specified.According to the previous thread, MATLAB can be made to open .m files by default in Ubuntu by editing the matlab.desktop file (usually in /usr/share/applications) and changing:
Exec=matlab -desktop
to
Exec=matlab -desktop -r "edit %f"
https://uk.mathworks.com/matlabcentral/answers/565784-defautl-to-open-m-files-in-matlab-linux
This has the side effect that opening MATLAB from its icon causes an empty editor window to be open. Can anyone advise how to avoid this? It looks like using X-Ayatana-Desktop-Shortcuts may help, but I cannot figure out how to make just opening the command window the default and opening the editor to happen only if a file is specified. According to the previous thread, MATLAB can be made to open .m files by default in Ubuntu by editing the matlab.desktop file (usually in /usr/share/applications) and changing:
Exec=matlab -desktop
to
Exec=matlab -desktop -r "edit %f"
https://uk.mathworks.com/matlabcentral/answers/565784-defautl-to-open-m-files-in-matlab-linux
This has the side effect that opening MATLAB from its icon causes an empty editor window to be open. Can anyone advise how to avoid this? It looks like using X-Ayatana-Desktop-Shortcuts may help, but I cannot figure out how to make just opening the command window the default and opening the editor to happen only if a file is specified. linux, ubuntu, x-ayatana-desktop-shortcuts MATLAB Answers — New Questions
Symbolic solve not returning all values
Hello everyone! I am new to MATLAB, and I am trying to use it to solve for some variables in a system of equations (this is for the node-voltage equations of a filter, but that isn’t fully relevant)
syms Va Vi Vhp Vlp Vbp R2 R3 R1 Rf R s C RH RB RL RF Vo
eqn0 = (( (Va-Vi)/R2) + ( (Va-Vbp)/R3) )== 0;
eqn1 = ( ((Va-Vlp)/R1) + ( (Va-Vhp)/Rf) )==0 ;
eqn2 = (-(Vhp/R) -(Vbp*s*C))==0;
eqn3 = (-(Vbp/R) – (Vlp*s*C))==0;
eqn4 = (-Vhp/RH -Vbp/RB -Vlp/RL – Vo/RF==0);
S = solve(eqn1, eqn2, eqn3, eqn0, eqn4)
Va, Vi, Vhp, Vlp, Vbp, and Vo are all "unknowns", while the rest are supposed to be treated as constants. Ideally, I want it to solve for H(s) = (Vo/Vi) .. Or really, I’d prefer to just be able to find out what every term rearranges to (i.e solving for Vbp, Vhp, Vlp, in terms of the other ones).
But when I run "solve", I get as follows.
Va: [2×1 sym]
Vbp: [2×1 sym]
Vhp: [2×1 sym]
Vi: [2×1 sym]
s: [2×1 sym]
Within these solutions are two (? why? is it not linear?.. Im not sure..) different expressions.
% For S.Vbp
ans =
-(Vlp*(RH – (-(RH*(4*RB^2*RF*Vlp + 4*RB^2*RL*Vo – RF*RH*RL*Vlp))/(RF*RL*Vlp))^(1/2)))/(2*RB)
-(Vlp*(RH + (-(RH*(4*RB^2*RF*Vlp + 4*RB^2*RL*Vo – RF*RH*RL*Vlp))/(RF*RL*Vlp))^(1/2)))/(2*RB)
%Besides the fact there’s *two* equations, this is what I want: just a big
%list of rearranged variables. But again: why two equations!
I am new to MATLAB and I do not really have a concept of the nature of linear equations (I haven’t taken linear algebra) besides "you need one for every variable you want to find", so I do not know where this issue may be coming from. Is it because all the other "variables" (constants) are being treated as variables and there aren’t enough equations? I’ve checked my equations with two friends and I am confident there’s nothing wrong with them.
Thanks!Hello everyone! I am new to MATLAB, and I am trying to use it to solve for some variables in a system of equations (this is for the node-voltage equations of a filter, but that isn’t fully relevant)
syms Va Vi Vhp Vlp Vbp R2 R3 R1 Rf R s C RH RB RL RF Vo
eqn0 = (( (Va-Vi)/R2) + ( (Va-Vbp)/R3) )== 0;
eqn1 = ( ((Va-Vlp)/R1) + ( (Va-Vhp)/Rf) )==0 ;
eqn2 = (-(Vhp/R) -(Vbp*s*C))==0;
eqn3 = (-(Vbp/R) – (Vlp*s*C))==0;
eqn4 = (-Vhp/RH -Vbp/RB -Vlp/RL – Vo/RF==0);
S = solve(eqn1, eqn2, eqn3, eqn0, eqn4)
Va, Vi, Vhp, Vlp, Vbp, and Vo are all "unknowns", while the rest are supposed to be treated as constants. Ideally, I want it to solve for H(s) = (Vo/Vi) .. Or really, I’d prefer to just be able to find out what every term rearranges to (i.e solving for Vbp, Vhp, Vlp, in terms of the other ones).
But when I run "solve", I get as follows.
Va: [2×1 sym]
Vbp: [2×1 sym]
Vhp: [2×1 sym]
Vi: [2×1 sym]
s: [2×1 sym]
Within these solutions are two (? why? is it not linear?.. Im not sure..) different expressions.
% For S.Vbp
ans =
-(Vlp*(RH – (-(RH*(4*RB^2*RF*Vlp + 4*RB^2*RL*Vo – RF*RH*RL*Vlp))/(RF*RL*Vlp))^(1/2)))/(2*RB)
-(Vlp*(RH + (-(RH*(4*RB^2*RF*Vlp + 4*RB^2*RL*Vo – RF*RH*RL*Vlp))/(RF*RL*Vlp))^(1/2)))/(2*RB)
%Besides the fact there’s *two* equations, this is what I want: just a big
%list of rearranged variables. But again: why two equations!
I am new to MATLAB and I do not really have a concept of the nature of linear equations (I haven’t taken linear algebra) besides "you need one for every variable you want to find", so I do not know where this issue may be coming from. Is it because all the other "variables" (constants) are being treated as variables and there aren’t enough equations? I’ve checked my equations with two friends and I am confident there’s nothing wrong with them.
Thanks! Hello everyone! I am new to MATLAB, and I am trying to use it to solve for some variables in a system of equations (this is for the node-voltage equations of a filter, but that isn’t fully relevant)
syms Va Vi Vhp Vlp Vbp R2 R3 R1 Rf R s C RH RB RL RF Vo
eqn0 = (( (Va-Vi)/R2) + ( (Va-Vbp)/R3) )== 0;
eqn1 = ( ((Va-Vlp)/R1) + ( (Va-Vhp)/Rf) )==0 ;
eqn2 = (-(Vhp/R) -(Vbp*s*C))==0;
eqn3 = (-(Vbp/R) – (Vlp*s*C))==0;
eqn4 = (-Vhp/RH -Vbp/RB -Vlp/RL – Vo/RF==0);
S = solve(eqn1, eqn2, eqn3, eqn0, eqn4)
Va, Vi, Vhp, Vlp, Vbp, and Vo are all "unknowns", while the rest are supposed to be treated as constants. Ideally, I want it to solve for H(s) = (Vo/Vi) .. Or really, I’d prefer to just be able to find out what every term rearranges to (i.e solving for Vbp, Vhp, Vlp, in terms of the other ones).
But when I run "solve", I get as follows.
Va: [2×1 sym]
Vbp: [2×1 sym]
Vhp: [2×1 sym]
Vi: [2×1 sym]
s: [2×1 sym]
Within these solutions are two (? why? is it not linear?.. Im not sure..) different expressions.
% For S.Vbp
ans =
-(Vlp*(RH – (-(RH*(4*RB^2*RF*Vlp + 4*RB^2*RL*Vo – RF*RH*RL*Vlp))/(RF*RL*Vlp))^(1/2)))/(2*RB)
-(Vlp*(RH + (-(RH*(4*RB^2*RF*Vlp + 4*RB^2*RL*Vo – RF*RH*RL*Vlp))/(RF*RL*Vlp))^(1/2)))/(2*RB)
%Besides the fact there’s *two* equations, this is what I want: just a big
%list of rearranged variables. But again: why two equations!
I am new to MATLAB and I do not really have a concept of the nature of linear equations (I haven’t taken linear algebra) besides "you need one for every variable you want to find", so I do not know where this issue may be coming from. Is it because all the other "variables" (constants) are being treated as variables and there aren’t enough equations? I’ve checked my equations with two friends and I am confident there’s nothing wrong with them.
Thanks! symbolic MATLAB Answers — New Questions









