Tag Archives: matlab
May I ask how to use MATLAB code to build an ECA module?
May I ask how to use MATLAB code to build an ECA module? The ECA module can refer to this paper: ECA Net: Efficient Channel Attention for Deep Convolutional Neural Networks.
Paper address: https://arxiv.org/abs/1910.03151May I ask how to use MATLAB code to build an ECA module? The ECA module can refer to this paper: ECA Net: Efficient Channel Attention for Deep Convolutional Neural Networks.
Paper address: https://arxiv.org/abs/1910.03151 May I ask how to use MATLAB code to build an ECA module? The ECA module can refer to this paper: ECA Net: Efficient Channel Attention for Deep Convolutional Neural Networks.
Paper address: https://arxiv.org/abs/1910.03151 eca-net, attention mechanism MATLAB Answers — New Questions
Convert pulse to digital
Dear Sir/Madam,
If i represent a pulse with y-axis as time and x-axis as frequency is it possible to convert that pulse into a digital representation having a period that changes with increase in frequency. The figure shows a pulse that starts at 10KHz rises to 10.1KHz then falls back to 10KHz. The sample time for discussion has been set to 1ms.
<</matlabcentral/answers/uploaded_files/117334/pulse.PNG>>
Regards JoeDear Sir/Madam,
If i represent a pulse with y-axis as time and x-axis as frequency is it possible to convert that pulse into a digital representation having a period that changes with increase in frequency. The figure shows a pulse that starts at 10KHz rises to 10.1KHz then falls back to 10KHz. The sample time for discussion has been set to 1ms.
<</matlabcentral/answers/uploaded_files/117334/pulse.PNG>>
Regards Joe Dear Sir/Madam,
If i represent a pulse with y-axis as time and x-axis as frequency is it possible to convert that pulse into a digital representation having a period that changes with increase in frequency. The figure shows a pulse that starts at 10KHz rises to 10.1KHz then falls back to 10KHz. The sample time for discussion has been set to 1ms.
<</matlabcentral/answers/uploaded_files/117334/pulse.PNG>>
Regards Joe pulse, frequency, digital, time MATLAB Answers — New Questions
Problem with finding the global minimum with fmincon
I am currently trying to find the global minimum for a strain-energy-function ("Holzapfel-Model") and I am running into multiple problems:
The SEF has the form
With
We can calculate , where
We want to determine the minimum of the least-square function
My solution was to put all these equations into one long one:
fun = @(x) sum((sigma_11 – (lambda_1.^2 – lambda_2.^2 .* lambda_1.^2).*x(1) + 2 .*lambda_1.^2 .*cos(x(4))^2 .* (2.*x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2) – 1) .* exp(x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2)-1).^2))).^2 + (sigma_22 – (lambda_2.^2 – lambda_2.^2 .* lambda_1.^2).*x(1) + 2 .*lambda_2.^2 .*sin(x(4))^2 .* (2.*x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2) – 1) .* exp(x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2)-1).^2))).^2)
and then use the following parameters
x0 = [15,500,12,0.75*pi];
A = [];
b = [];
Aeq = [];
beq = [];
lb = [0,0,0,0];
ub = [inf, inf, inf, pi];
chi = fmincon(fun, x0,A,b,Aeq,beq,lb,ub,nonlcon)
function [c,ceq] = nonlcon(x,lambda_1,lambda_2)
c =1-(lambda_1.^2 .* cos(x(4)).^2 + lambda_2.^2 * sin(x(4)).^2) ;
ceq = [];
end
With these parameters, I can somewhat get close to my data points.
Now my questions:
I don’t think I understood c,ceq correctly. I used c to account for the constraint on I4, but I’m not sure if this was the right way to do it.
With the initial guess for x0, I can get close but it never seems to approach my curve nearly enough. How do I know if I have a good starting guess, and is fmincon even the right approach for this problem.
I have multiple data sets, for different stretch ratios (lambda_1:lambda_2: 1-1, 1-0.75, 0.75-1, 1-0.5,0.5-1) and since they are the same sample, I would like to use those datas to get one set of parameters for all of them. I tried to put all my data into a single vector, (1:30 would be the first data set, 31:^60 the second,…). This does not seem to work well. Should I find the solution for just one curve and than try to average over the parameters? As you guys can see, I am doing this parameter evaluation thing the first time ever and I would greatly appreciate help.I am currently trying to find the global minimum for a strain-energy-function ("Holzapfel-Model") and I am running into multiple problems:
The SEF has the form
With
We can calculate , where
We want to determine the minimum of the least-square function
My solution was to put all these equations into one long one:
fun = @(x) sum((sigma_11 – (lambda_1.^2 – lambda_2.^2 .* lambda_1.^2).*x(1) + 2 .*lambda_1.^2 .*cos(x(4))^2 .* (2.*x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2) – 1) .* exp(x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2)-1).^2))).^2 + (sigma_22 – (lambda_2.^2 – lambda_2.^2 .* lambda_1.^2).*x(1) + 2 .*lambda_2.^2 .*sin(x(4))^2 .* (2.*x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2) – 1) .* exp(x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2)-1).^2))).^2)
and then use the following parameters
x0 = [15,500,12,0.75*pi];
A = [];
b = [];
Aeq = [];
beq = [];
lb = [0,0,0,0];
ub = [inf, inf, inf, pi];
chi = fmincon(fun, x0,A,b,Aeq,beq,lb,ub,nonlcon)
function [c,ceq] = nonlcon(x,lambda_1,lambda_2)
c =1-(lambda_1.^2 .* cos(x(4)).^2 + lambda_2.^2 * sin(x(4)).^2) ;
ceq = [];
end
With these parameters, I can somewhat get close to my data points.
Now my questions:
I don’t think I understood c,ceq correctly. I used c to account for the constraint on I4, but I’m not sure if this was the right way to do it.
With the initial guess for x0, I can get close but it never seems to approach my curve nearly enough. How do I know if I have a good starting guess, and is fmincon even the right approach for this problem.
I have multiple data sets, for different stretch ratios (lambda_1:lambda_2: 1-1, 1-0.75, 0.75-1, 1-0.5,0.5-1) and since they are the same sample, I would like to use those datas to get one set of parameters for all of them. I tried to put all my data into a single vector, (1:30 would be the first data set, 31:^60 the second,…). This does not seem to work well. Should I find the solution for just one curve and than try to average over the parameters? As you guys can see, I am doing this parameter evaluation thing the first time ever and I would greatly appreciate help. I am currently trying to find the global minimum for a strain-energy-function ("Holzapfel-Model") and I am running into multiple problems:
The SEF has the form
With
We can calculate , where
We want to determine the minimum of the least-square function
My solution was to put all these equations into one long one:
fun = @(x) sum((sigma_11 – (lambda_1.^2 – lambda_2.^2 .* lambda_1.^2).*x(1) + 2 .*lambda_1.^2 .*cos(x(4))^2 .* (2.*x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2) – 1) .* exp(x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2)-1).^2))).^2 + (sigma_22 – (lambda_2.^2 – lambda_2.^2 .* lambda_1.^2).*x(1) + 2 .*lambda_2.^2 .*sin(x(4))^2 .* (2.*x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2) – 1) .* exp(x(2).*((lambda_1.^2 .* cos(x(4))^2 + lambda_2.^2 .* sin(x(4))^2)-1).^2))).^2)
and then use the following parameters
x0 = [15,500,12,0.75*pi];
A = [];
b = [];
Aeq = [];
beq = [];
lb = [0,0,0,0];
ub = [inf, inf, inf, pi];
chi = fmincon(fun, x0,A,b,Aeq,beq,lb,ub,nonlcon)
function [c,ceq] = nonlcon(x,lambda_1,lambda_2)
c =1-(lambda_1.^2 .* cos(x(4)).^2 + lambda_2.^2 * sin(x(4)).^2) ;
ceq = [];
end
With these parameters, I can somewhat get close to my data points.
Now my questions:
I don’t think I understood c,ceq correctly. I used c to account for the constraint on I4, but I’m not sure if this was the right way to do it.
With the initial guess for x0, I can get close but it never seems to approach my curve nearly enough. How do I know if I have a good starting guess, and is fmincon even the right approach for this problem.
I have multiple data sets, for different stretch ratios (lambda_1:lambda_2: 1-1, 1-0.75, 0.75-1, 1-0.5,0.5-1) and since they are the same sample, I would like to use those datas to get one set of parameters for all of them. I tried to put all my data into a single vector, (1:30 would be the first data set, 31:^60 the second,…). This does not seem to work well. Should I find the solution for just one curve and than try to average over the parameters? As you guys can see, I am doing this parameter evaluation thing the first time ever and I would greatly appreciate help. fmincon, nonlinear, curve fitting, optimization MATLAB Answers — New Questions
Problem with direct calculation on table with std and “omitnan”
Since R2023a, it is possible to perform calculations directly on tables (and timetables) without extracting their data by indexing.
https://fr.mathworks.com/help/matlab/matlab_prog/direct-calculations-on-tables-and-timetables.html?searchHighlight=table&s_tid=srchtitle_table_9
I want use std directly on a numeric table where I can have nan.
For example :
load patients
T = table(Age,Height,Weight,Systolic,Diastolic)
mean(T,"omitnan")
It’s fine.
But why there is a problem with std(T,"omitnan") ?
% Applying the function ‘std’ to the variable ‘Age’ generated an error.
I can use std(T{:,:},"omitnan") or std(T.Variables,"omitnan") but I lost the possibility to work directly with my table.
Did I miss something ?
Do you have any suggestion ?
Thank you in advance.
SAINTHILLIER Jean MarieSince R2023a, it is possible to perform calculations directly on tables (and timetables) without extracting their data by indexing.
https://fr.mathworks.com/help/matlab/matlab_prog/direct-calculations-on-tables-and-timetables.html?searchHighlight=table&s_tid=srchtitle_table_9
I want use std directly on a numeric table where I can have nan.
For example :
load patients
T = table(Age,Height,Weight,Systolic,Diastolic)
mean(T,"omitnan")
It’s fine.
But why there is a problem with std(T,"omitnan") ?
% Applying the function ‘std’ to the variable ‘Age’ generated an error.
I can use std(T{:,:},"omitnan") or std(T.Variables,"omitnan") but I lost the possibility to work directly with my table.
Did I miss something ?
Do you have any suggestion ?
Thank you in advance.
SAINTHILLIER Jean Marie Since R2023a, it is possible to perform calculations directly on tables (and timetables) without extracting their data by indexing.
https://fr.mathworks.com/help/matlab/matlab_prog/direct-calculations-on-tables-and-timetables.html?searchHighlight=table&s_tid=srchtitle_table_9
I want use std directly on a numeric table where I can have nan.
For example :
load patients
T = table(Age,Height,Weight,Systolic,Diastolic)
mean(T,"omitnan")
It’s fine.
But why there is a problem with std(T,"omitnan") ?
% Applying the function ‘std’ to the variable ‘Age’ generated an error.
I can use std(T{:,:},"omitnan") or std(T.Variables,"omitnan") but I lost the possibility to work directly with my table.
Did I miss something ?
Do you have any suggestion ?
Thank you in advance.
SAINTHILLIER Jean Marie table, std MATLAB Answers — New Questions
Create and plot an oriented graph of a circuit from a netlist
Hello,
it should be a ridiculously trivial task, but I have to admit I’ve been stuck on it for a few months. Sadly, I’m not very good at Python either, so I’m coming here.
Assume that I have some circuit like the one below:
I want to read and parse a netlist such that I create a digraph object, which can later be used for testing subgraphs being a spanning tree and alike graph theoretic features. Prsing a netlist posses no difficulty, but it looks like the digraph function does not care about the order in my input cells and when I plot the graph, it is labeled wrongly.
I have spent weeks on it with no result. Can you see a easy solution how to turn it into a graph object and plot it accordingly?
Code below produces obvisouly wrong plot, for instance resistors, while the topoogy seems to be idnetified correctly. Edges/Nodes are mislabeled.
clear
close all
clc
netlist = {
‘R1 N001 0 R’;
‘R2 N002 N001 R’;
‘R3 0 N002 R’;
‘C1 N002 N001 C’;
‘C2 N001 0 C’;
‘C3 N002 0 C’;
‘L1 N002 N001 L’;
‘L2 0 N001 L’;
‘L3 0 N002 L’
};
elements = {};
sourceNodes = {};
targetNodes = {};
labels = {};
for i = 1:length(netlist)
parts = strsplit(netlist{i});
elements{end+1} = parts{1};
sourceNodes{end+1} = parts{2};
targetNodes{end+1} = parts{3};
labels{end+1} = [parts{4} ‘ – ‘ parts{1}];
end
edgeTable = table(sourceNodes’, targetNodes’, labels’, ‘VariableNames’, {‘EndNodes’, ‘EndNodes2’, ‘Label’});
G = digraph(edgeTable.EndNodes, edgeTable.EndNodes2);
G.Edges.Label = edgeTable.Label;
h = plot(G, ‘EdgeLabel’, G.Edges.Label, ‘NodeLabel’, G.Nodes.Name, ‘Layout’, ‘force’);Hello,
it should be a ridiculously trivial task, but I have to admit I’ve been stuck on it for a few months. Sadly, I’m not very good at Python either, so I’m coming here.
Assume that I have some circuit like the one below:
I want to read and parse a netlist such that I create a digraph object, which can later be used for testing subgraphs being a spanning tree and alike graph theoretic features. Prsing a netlist posses no difficulty, but it looks like the digraph function does not care about the order in my input cells and when I plot the graph, it is labeled wrongly.
I have spent weeks on it with no result. Can you see a easy solution how to turn it into a graph object and plot it accordingly?
Code below produces obvisouly wrong plot, for instance resistors, while the topoogy seems to be idnetified correctly. Edges/Nodes are mislabeled.
clear
close all
clc
netlist = {
‘R1 N001 0 R’;
‘R2 N002 N001 R’;
‘R3 0 N002 R’;
‘C1 N002 N001 C’;
‘C2 N001 0 C’;
‘C3 N002 0 C’;
‘L1 N002 N001 L’;
‘L2 0 N001 L’;
‘L3 0 N002 L’
};
elements = {};
sourceNodes = {};
targetNodes = {};
labels = {};
for i = 1:length(netlist)
parts = strsplit(netlist{i});
elements{end+1} = parts{1};
sourceNodes{end+1} = parts{2};
targetNodes{end+1} = parts{3};
labels{end+1} = [parts{4} ‘ – ‘ parts{1}];
end
edgeTable = table(sourceNodes’, targetNodes’, labels’, ‘VariableNames’, {‘EndNodes’, ‘EndNodes2’, ‘Label’});
G = digraph(edgeTable.EndNodes, edgeTable.EndNodes2);
G.Edges.Label = edgeTable.Label;
h = plot(G, ‘EdgeLabel’, G.Edges.Label, ‘NodeLabel’, G.Nodes.Name, ‘Layout’, ‘force’); Hello,
it should be a ridiculously trivial task, but I have to admit I’ve been stuck on it for a few months. Sadly, I’m not very good at Python either, so I’m coming here.
Assume that I have some circuit like the one below:
I want to read and parse a netlist such that I create a digraph object, which can later be used for testing subgraphs being a spanning tree and alike graph theoretic features. Prsing a netlist posses no difficulty, but it looks like the digraph function does not care about the order in my input cells and when I plot the graph, it is labeled wrongly.
I have spent weeks on it with no result. Can you see a easy solution how to turn it into a graph object and plot it accordingly?
Code below produces obvisouly wrong plot, for instance resistors, while the topoogy seems to be idnetified correctly. Edges/Nodes are mislabeled.
clear
close all
clc
netlist = {
‘R1 N001 0 R’;
‘R2 N002 N001 R’;
‘R3 0 N002 R’;
‘C1 N002 N001 C’;
‘C2 N001 0 C’;
‘C3 N002 0 C’;
‘L1 N002 N001 L’;
‘L2 0 N001 L’;
‘L3 0 N002 L’
};
elements = {};
sourceNodes = {};
targetNodes = {};
labels = {};
for i = 1:length(netlist)
parts = strsplit(netlist{i});
elements{end+1} = parts{1};
sourceNodes{end+1} = parts{2};
targetNodes{end+1} = parts{3};
labels{end+1} = [parts{4} ‘ – ‘ parts{1}];
end
edgeTable = table(sourceNodes’, targetNodes’, labels’, ‘VariableNames’, {‘EndNodes’, ‘EndNodes2’, ‘Label’});
G = digraph(edgeTable.EndNodes, edgeTable.EndNodes2);
G.Edges.Label = edgeTable.Label;
h = plot(G, ‘EdgeLabel’, G.Edges.Label, ‘NodeLabel’, G.Nodes.Name, ‘Layout’, ‘force’); digraph, circuit, netlist, spanning tree, graph plotting, spice MATLAB Answers — New Questions
Is it possible to realize self-supervised RL by adding auxiliary loss to the loss of Critic of PPO agent?
I am trying to realize self-supervised (SS) RL in MATLAB by using PPO agent. The SS RL can improve exploration and thereby enhance the convergence. In particular, it can be explained as follows:
At step , in addition to the original head of Critic that output the value via fullyConnectedLayer(1), there is an additional layer that is parallel to the original head of Critic and connected to the main body of critic, which outputs the the prediction of future state, denoted by , via fullyConnectedLayer(N) with N being the dimension of .
Then, such a prediction of future state will be used to calculate the SS loss by comparing it with the real future state, i.e., , where is the real future state.
Later, such a SS loss will be sampled and thereafter added to the original loss of Critic , i.e., 5-b in https://ww2.mathworks.cn/help/reinforcement-learning/ug/proximal-policy-optimization-agents.html, as follows
,
which requires to additionally add an auxiliary loss to the original loss of Critic.
So, is it possible to realize the above SS RL while avoiding significant modification in the source code of RL toolbox? Thank you!I am trying to realize self-supervised (SS) RL in MATLAB by using PPO agent. The SS RL can improve exploration and thereby enhance the convergence. In particular, it can be explained as follows:
At step , in addition to the original head of Critic that output the value via fullyConnectedLayer(1), there is an additional layer that is parallel to the original head of Critic and connected to the main body of critic, which outputs the the prediction of future state, denoted by , via fullyConnectedLayer(N) with N being the dimension of .
Then, such a prediction of future state will be used to calculate the SS loss by comparing it with the real future state, i.e., , where is the real future state.
Later, such a SS loss will be sampled and thereafter added to the original loss of Critic , i.e., 5-b in https://ww2.mathworks.cn/help/reinforcement-learning/ug/proximal-policy-optimization-agents.html, as follows
,
which requires to additionally add an auxiliary loss to the original loss of Critic.
So, is it possible to realize the above SS RL while avoiding significant modification in the source code of RL toolbox? Thank you! I am trying to realize self-supervised (SS) RL in MATLAB by using PPO agent. The SS RL can improve exploration and thereby enhance the convergence. In particular, it can be explained as follows:
At step , in addition to the original head of Critic that output the value via fullyConnectedLayer(1), there is an additional layer that is parallel to the original head of Critic and connected to the main body of critic, which outputs the the prediction of future state, denoted by , via fullyConnectedLayer(N) with N being the dimension of .
Then, such a prediction of future state will be used to calculate the SS loss by comparing it with the real future state, i.e., , where is the real future state.
Later, such a SS loss will be sampled and thereafter added to the original loss of Critic , i.e., 5-b in https://ww2.mathworks.cn/help/reinforcement-learning/ug/proximal-policy-optimization-agents.html, as follows
,
which requires to additionally add an auxiliary loss to the original loss of Critic.
So, is it possible to realize the above SS RL while avoiding significant modification in the source code of RL toolbox? Thank you! self-supervised rl, auxiliary loss, loss of critic, rlppoagent MATLAB Answers — New Questions
How to extract specific matrix after implemeting svd function
I want to solve PEB minimization problem in sort of RIS problem. So I have formulated SDP problem via ‘CVX’ and at the end of the CVX formulation, using built-in svd(or svds) function to extract RIS phase profile matrix F(with size M times T, M=# of RIS elements and T is # of transmissions). Optimal solution of CVX is X which has size M by M. And X is FF^H. From X F is extracted by using svds as size of M by T.
The code is below,
M = signal.M;
T = signal.T;
% k-th column of identity matrix
e1 = [1; 0; 0];
e2 = [0; 1; 0];
e3 = [0; 0; 1];
% define optimization problem
cvx_begin sdp
variable X(M, M) hermitian
variable u(3, 1)
minimize(sum(u))
subject to
[J_car(1:3, 1:3), e1; e1′, u(1)] >= 0;
[J_car(1:3, 1:3), e2; e2′, u(2)] >= 0;
[J_car(1:3, 1:3), e3; e3′, u(3)] >= 0;
trace(X) == M * T;
X >= 0;
cvx_end
optimX = X;
[U, S, V] = svds(optimX, T);
num_singular_values = min(size(S, 1), T);
optimF = U(:, 1:num_singular_values) * sqrt(S(1:num_singular_values, 1:num_singular_values));
end
and the optimization problem is:
Then my questions are:
Is it correct method using ‘svd’ to extract F(size M by T) from optimal solution X?
If not, what method can I try to? If possible, comment breif code for it.
It is not programming issue, but about mathematical, Is sum of all elements in auxiliary variable(objective for (12)) same as objective for (11)?I want to solve PEB minimization problem in sort of RIS problem. So I have formulated SDP problem via ‘CVX’ and at the end of the CVX formulation, using built-in svd(or svds) function to extract RIS phase profile matrix F(with size M times T, M=# of RIS elements and T is # of transmissions). Optimal solution of CVX is X which has size M by M. And X is FF^H. From X F is extracted by using svds as size of M by T.
The code is below,
M = signal.M;
T = signal.T;
% k-th column of identity matrix
e1 = [1; 0; 0];
e2 = [0; 1; 0];
e3 = [0; 0; 1];
% define optimization problem
cvx_begin sdp
variable X(M, M) hermitian
variable u(3, 1)
minimize(sum(u))
subject to
[J_car(1:3, 1:3), e1; e1′, u(1)] >= 0;
[J_car(1:3, 1:3), e2; e2′, u(2)] >= 0;
[J_car(1:3, 1:3), e3; e3′, u(3)] >= 0;
trace(X) == M * T;
X >= 0;
cvx_end
optimX = X;
[U, S, V] = svds(optimX, T);
num_singular_values = min(size(S, 1), T);
optimF = U(:, 1:num_singular_values) * sqrt(S(1:num_singular_values, 1:num_singular_values));
end
and the optimization problem is:
Then my questions are:
Is it correct method using ‘svd’ to extract F(size M by T) from optimal solution X?
If not, what method can I try to? If possible, comment breif code for it.
It is not programming issue, but about mathematical, Is sum of all elements in auxiliary variable(objective for (12)) same as objective for (11)? I want to solve PEB minimization problem in sort of RIS problem. So I have formulated SDP problem via ‘CVX’ and at the end of the CVX formulation, using built-in svd(or svds) function to extract RIS phase profile matrix F(with size M times T, M=# of RIS elements and T is # of transmissions). Optimal solution of CVX is X which has size M by M. And X is FF^H. From X F is extracted by using svds as size of M by T.
The code is below,
M = signal.M;
T = signal.T;
% k-th column of identity matrix
e1 = [1; 0; 0];
e2 = [0; 1; 0];
e3 = [0; 0; 1];
% define optimization problem
cvx_begin sdp
variable X(M, M) hermitian
variable u(3, 1)
minimize(sum(u))
subject to
[J_car(1:3, 1:3), e1; e1′, u(1)] >= 0;
[J_car(1:3, 1:3), e2; e2′, u(2)] >= 0;
[J_car(1:3, 1:3), e3; e3′, u(3)] >= 0;
trace(X) == M * T;
X >= 0;
cvx_end
optimX = X;
[U, S, V] = svds(optimX, T);
num_singular_values = min(size(S, 1), T);
optimF = U(:, 1:num_singular_values) * sqrt(S(1:num_singular_values, 1:num_singular_values));
end
and the optimization problem is:
Then my questions are:
Is it correct method using ‘svd’ to extract F(size M by T) from optimal solution X?
If not, what method can I try to? If possible, comment breif code for it.
It is not programming issue, but about mathematical, Is sum of all elements in auxiliary variable(objective for (12)) same as objective for (11)? svd, ris, mimo, cvx, optim MATLAB Answers — New Questions
Is there any utility to display message or variables in custom criteria script of simulink test ?
In custom criteria script of simulink test, the disp() doesnt work and so it is very hard to debug the script. I had to use error() and it doesnt support most of the types like structure, cell etc. Is there any utility available for debuging the script in custom criteria script ?In custom criteria script of simulink test, the disp() doesnt work and so it is very hard to debug the script. I had to use error() and it doesnt support most of the types like structure, cell etc. Is there any utility available for debuging the script in custom criteria script ? In custom criteria script of simulink test, the disp() doesnt work and so it is very hard to debug the script. I had to use error() and it doesnt support most of the types like structure, cell etc. Is there any utility available for debuging the script in custom criteria script ? simulink test, custom criteria script MATLAB Answers — New Questions
HDL Cosimulation with Cadence Xcelium setup
When running the example of "GettingStartedWithSimulinkHDLCosimExample" with Cadence Xcelium , I get these following messages.
Executing nclaunch tclstart commands…
xmsim(64): 22.09-s004: (c) Copyright 1995-2022 Cadence Design Systems, Inc.
xmsim: *W,NOMTDGUI: Multi-Threaded Dumping is disabled for interactive debug mode.
xmsim: *E,STRPIN: Could not initialize SimVision connection: SimVision/Indago process terminated before a connection was established.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
/tools/cds/xceliummain_22.09.004_Linux/tools.lnx86/simvision/bin/64bit/simvision: line 48: cds_plat: command not found
/tools/cds/xceliummain_22.09.004_Linux/tools.lnx86/simvision/bin/64bit/simvision: line 101: /tools/cds/xceliummain_22.09.004_Linux/tools./simvision/bin/64bit/simvision.exe: No such file or directory
SimVision/Indago process terminated before a connection could be established.
while executing
"exec <@stdin >@stdout xmsim -gui rcosflt_rtl -64bit -input {@simvision {set w [waveform new]}} -input {@simvision {waveform add -using $w -signals rco…"
("uplevel" body line 1)
invoked from within
"uplevel 1 [join $args]"
(procedure "hdlsimulink" line 22)
invoked from within
"hdlsimulink rcosflt_rtl -64bit -socket 44014 -input "{@simvision {set w [waveform new]}}" -input "{@simvision {waveform add -using $w -signals rc…"
(file "compile_and_launch.tcl" line 66)
ERROR hit any key to exit xterm
Could you please guide me how to set up cosimulation with Cadence Xcelium?When running the example of "GettingStartedWithSimulinkHDLCosimExample" with Cadence Xcelium , I get these following messages.
Executing nclaunch tclstart commands…
xmsim(64): 22.09-s004: (c) Copyright 1995-2022 Cadence Design Systems, Inc.
xmsim: *W,NOMTDGUI: Multi-Threaded Dumping is disabled for interactive debug mode.
xmsim: *E,STRPIN: Could not initialize SimVision connection: SimVision/Indago process terminated before a connection was established.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
/tools/cds/xceliummain_22.09.004_Linux/tools.lnx86/simvision/bin/64bit/simvision: line 48: cds_plat: command not found
/tools/cds/xceliummain_22.09.004_Linux/tools.lnx86/simvision/bin/64bit/simvision: line 101: /tools/cds/xceliummain_22.09.004_Linux/tools./simvision/bin/64bit/simvision.exe: No such file or directory
SimVision/Indago process terminated before a connection could be established.
while executing
"exec <@stdin >@stdout xmsim -gui rcosflt_rtl -64bit -input {@simvision {set w [waveform new]}} -input {@simvision {waveform add -using $w -signals rco…"
("uplevel" body line 1)
invoked from within
"uplevel 1 [join $args]"
(procedure "hdlsimulink" line 22)
invoked from within
"hdlsimulink rcosflt_rtl -64bit -socket 44014 -input "{@simvision {set w [waveform new]}}" -input "{@simvision {waveform add -using $w -signals rc…"
(file "compile_and_launch.tcl" line 66)
ERROR hit any key to exit xterm
Could you please guide me how to set up cosimulation with Cadence Xcelium? When running the example of "GettingStartedWithSimulinkHDLCosimExample" with Cadence Xcelium , I get these following messages.
Executing nclaunch tclstart commands…
xmsim(64): 22.09-s004: (c) Copyright 1995-2022 Cadence Design Systems, Inc.
xmsim: *W,NOMTDGUI: Multi-Threaded Dumping is disabled for interactive debug mode.
xmsim: *E,STRPIN: Could not initialize SimVision connection: SimVision/Indago process terminated before a connection was established.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/tools/matlab/R2023bU1/sys/os/glnxa64/libstdc++.so.6’ from LD_PRELOAD cannot be preloaded: ignored.
/tools/cds/xceliummain_22.09.004_Linux/tools.lnx86/simvision/bin/64bit/simvision: line 48: cds_plat: command not found
/tools/cds/xceliummain_22.09.004_Linux/tools.lnx86/simvision/bin/64bit/simvision: line 101: /tools/cds/xceliummain_22.09.004_Linux/tools./simvision/bin/64bit/simvision.exe: No such file or directory
SimVision/Indago process terminated before a connection could be established.
while executing
"exec <@stdin >@stdout xmsim -gui rcosflt_rtl -64bit -input {@simvision {set w [waveform new]}} -input {@simvision {waveform add -using $w -signals rco…"
("uplevel" body line 1)
invoked from within
"uplevel 1 [join $args]"
(procedure "hdlsimulink" line 22)
invoked from within
"hdlsimulink rcosflt_rtl -64bit -socket 44014 -input "{@simvision {set w [waveform new]}}" -input "{@simvision {waveform add -using $w -signals rc…"
(file "compile_and_launch.tcl" line 66)
ERROR hit any key to exit xterm
Could you please guide me how to set up cosimulation with Cadence Xcelium? cosimulation, cadence, hldverifier MATLAB Answers — New Questions
MobileNetV1 & MobileNetV3 matlab code for detecting wafer map defect patterns
Give MobileNetV1 & MobileNetV3 matlab code for identifying defect wafer map patternsGive MobileNetV1 & MobileNetV3 matlab code for identifying defect wafer map patterns Give MobileNetV1 & MobileNetV3 matlab code for identifying defect wafer map patterns mobilenetv1 mobilenetv3 MATLAB Answers — New Questions
how can i show my data on thingsview free app?
i used the read api key to upload my data but it is showing invalid api key. kindly answeri used the read api key to upload my data but it is showing invalid api key. kindly answer i used the read api key to upload my data but it is showing invalid api key. kindly answer 🙂 MATLAB Answers — New Questions
Obtain information after text pattern
Dear all
I am dealing with files of extension .mat (not related to MatLab) like the one attached. I would like to be able to save in a variable the numerical value that appears after the text pattern "material[x]:damping-constant = 1.0" (so, in this case, 1). As you can see, here x can take values from 1 to 8, so it would be useful for me to have an array where each index position stores the the corresponding value.
Any ideas?Dear all
I am dealing with files of extension .mat (not related to MatLab) like the one attached. I would like to be able to save in a variable the numerical value that appears after the text pattern "material[x]:damping-constant = 1.0" (so, in this case, 1). As you can see, here x can take values from 1 to 8, so it would be useful for me to have an array where each index position stores the the corresponding value.
Any ideas? Dear all
I am dealing with files of extension .mat (not related to MatLab) like the one attached. I would like to be able to save in a variable the numerical value that appears after the text pattern "material[x]:damping-constant = 1.0" (so, in this case, 1). As you can see, here x can take values from 1 to 8, so it would be useful for me to have an array where each index position stores the the corresponding value.
Any ideas? information after text pattern MATLAB Answers — New Questions
how can i load multiple/all audio files(.wav) in matlab ? all files have different names.
i have a folder containing a number of audio files. i want to load them in a loop so that each audio signals can undergo some operations that i intend to perform.i have a folder containing a number of audio files. i want to load them in a loop so that each audio signals can undergo some operations that i intend to perform. i have a folder containing a number of audio files. i want to load them in a loop so that each audio signals can undergo some operations that i intend to perform. audio signal, loading multiple files, matlab MATLAB Answers — New Questions
Live script: Error Loading
Hi
I have created a matlab livescript file, and saved it as .mlx . When i now try to open the file i get the error:
Error Loading "path to file"
I have tried opening it in a text editor, but it is just empty, though the file is 219 kb.
What can I do?Hi
I have created a matlab livescript file, and saved it as .mlx . When i now try to open the file i get the error:
Error Loading "path to file"
I have tried opening it in a text editor, but it is just empty, though the file is 219 kb.
What can I do? Hi
I have created a matlab livescript file, and saved it as .mlx . When i now try to open the file i get the error:
Error Loading "path to file"
I have tried opening it in a text editor, but it is just empty, though the file is 219 kb.
What can I do? error, live script MATLAB Answers — New Questions
How to modify my MATLAB code to train a neural network with images from different directions?
I am working on a project to estimate the weight of pears using their RGB and Depth images in MATLAB. Initially, I used only front-facing images for training, but now I want to improve the accuracy by including images taken from approximately 90 degrees to the left or right of the pear, in addition to the Depth images.
I tried modifying the code to accommodate these new images, but I’m facing some issues.
I would like to change the following points.
・The pear image uses the front, an image moved approximately 90 degrees to the left or right from the front, and a Depth image.
・I want to put all my data in a datastore.
Currently, the code listed is the code that I have modified, but in this state an error occurs and it is impossible to predict.Please lend me your strength.
cd ‘RGB front file path’
folder_name = pwd;
XImageTrainFront = imageDatastore(folder_name);
cd ‘RGB side file path’
folder_name = pwd;
XImageTrainSide = imageDatastore(folder_name);
cd ‘Depth file path’
folder_name = pwd;
XDispTrain = imageDatastore(folder_name);
YTrain = [ data ]; % weight labels
YTrain = arrayDatastore(YTrain);
% Combine datasets
ds = combine(XImageTrainFront, XImageTrainSide, XDispTrain, YTrain);
dsrand = shuffle(ds);
dsVali = partition(dsrand, 10, 1);
dsTest = partition(dsrand, 10, 2);
ds1=partition(dsrand,10,3);
ds2=partition(dsrand,10,4);
ds3=partition(dsrand,10,5);
ds4=partition(dsrand,10,6);
ds5=partition(dsrand,10,7);
ds6=partition(dsrand,10,8);
ds7=partition(dsrand,10,9);
ds8=partition(dsrand,10,10);
dsTrain=combine(ds1,ds2,ds3,ds4,ds5,ds6,ds7,ds8,ReadOrder="sequential");
YTest = readall(dsTest);
YTest = YTest(:,4);
YTest = cell2mat(YTest);
cd ‘path to googlenet300400_multiple.mat’
load googlenet300400_multiple.mat
miniBatchSize = 16;
options = trainingOptions(‘sgdm’, …
‘MiniBatchSize’, miniBatchSize, …
‘MaxEpochs’, 300, …
‘InitialLearnRate’, 1e-7, …
‘LearnRateSchedule’, ‘piecewise’, …
‘LearnRateDropFactor’, 0.1, …
‘LearnRateDropPeriod’, 30, …
‘Shuffle’, ‘every-epoch’, …
‘ValidationData’, dsVali, …
‘ValidationFrequency’, 50, …
‘Plots’, ‘training-progress’, …
‘Verbose’, true);
net = trainNetwork(dsTrain, lgraph_2, options);
YPredicted = predict(net, dsTest);
predictionError = YTest – YPredicted;
squares = predictionError.^2;
rmse = sqrt(mean(squares));
figure
scatter(YPredicted, YTest, ‘+’);
xlabel("Predicted Value");
ylabel("True Value");
hold on;
plot([100 550], [100 550], ‘r–‘);
Error message that occurred during modification.
Please respond to the following error. Error using: trainNetwork (line 191)
Invalid training data. The output size of the last layer ([1 1 1]) is the response size ([1 1 360000])
does not match.
Error: newcord2 (line 93)
net = trainNetwork(dsTrain, lgraph_2, options);
Error using: nnet.cnn.LayerGraph/replaceLayer (line 300)
Layer ‘finalLayerName’ does not exist.
Error: newcord2 (line 85)
lgraph_2 = replaceLayer(lgraph_2, ‘finalLayerName’, finalLayer);I am working on a project to estimate the weight of pears using their RGB and Depth images in MATLAB. Initially, I used only front-facing images for training, but now I want to improve the accuracy by including images taken from approximately 90 degrees to the left or right of the pear, in addition to the Depth images.
I tried modifying the code to accommodate these new images, but I’m facing some issues.
I would like to change the following points.
・The pear image uses the front, an image moved approximately 90 degrees to the left or right from the front, and a Depth image.
・I want to put all my data in a datastore.
Currently, the code listed is the code that I have modified, but in this state an error occurs and it is impossible to predict.Please lend me your strength.
cd ‘RGB front file path’
folder_name = pwd;
XImageTrainFront = imageDatastore(folder_name);
cd ‘RGB side file path’
folder_name = pwd;
XImageTrainSide = imageDatastore(folder_name);
cd ‘Depth file path’
folder_name = pwd;
XDispTrain = imageDatastore(folder_name);
YTrain = [ data ]; % weight labels
YTrain = arrayDatastore(YTrain);
% Combine datasets
ds = combine(XImageTrainFront, XImageTrainSide, XDispTrain, YTrain);
dsrand = shuffle(ds);
dsVali = partition(dsrand, 10, 1);
dsTest = partition(dsrand, 10, 2);
ds1=partition(dsrand,10,3);
ds2=partition(dsrand,10,4);
ds3=partition(dsrand,10,5);
ds4=partition(dsrand,10,6);
ds5=partition(dsrand,10,7);
ds6=partition(dsrand,10,8);
ds7=partition(dsrand,10,9);
ds8=partition(dsrand,10,10);
dsTrain=combine(ds1,ds2,ds3,ds4,ds5,ds6,ds7,ds8,ReadOrder="sequential");
YTest = readall(dsTest);
YTest = YTest(:,4);
YTest = cell2mat(YTest);
cd ‘path to googlenet300400_multiple.mat’
load googlenet300400_multiple.mat
miniBatchSize = 16;
options = trainingOptions(‘sgdm’, …
‘MiniBatchSize’, miniBatchSize, …
‘MaxEpochs’, 300, …
‘InitialLearnRate’, 1e-7, …
‘LearnRateSchedule’, ‘piecewise’, …
‘LearnRateDropFactor’, 0.1, …
‘LearnRateDropPeriod’, 30, …
‘Shuffle’, ‘every-epoch’, …
‘ValidationData’, dsVali, …
‘ValidationFrequency’, 50, …
‘Plots’, ‘training-progress’, …
‘Verbose’, true);
net = trainNetwork(dsTrain, lgraph_2, options);
YPredicted = predict(net, dsTest);
predictionError = YTest – YPredicted;
squares = predictionError.^2;
rmse = sqrt(mean(squares));
figure
scatter(YPredicted, YTest, ‘+’);
xlabel("Predicted Value");
ylabel("True Value");
hold on;
plot([100 550], [100 550], ‘r–‘);
Error message that occurred during modification.
Please respond to the following error. Error using: trainNetwork (line 191)
Invalid training data. The output size of the last layer ([1 1 1]) is the response size ([1 1 360000])
does not match.
Error: newcord2 (line 93)
net = trainNetwork(dsTrain, lgraph_2, options);
Error using: nnet.cnn.LayerGraph/replaceLayer (line 300)
Layer ‘finalLayerName’ does not exist.
Error: newcord2 (line 85)
lgraph_2 = replaceLayer(lgraph_2, ‘finalLayerName’, finalLayer); I am working on a project to estimate the weight of pears using their RGB and Depth images in MATLAB. Initially, I used only front-facing images for training, but now I want to improve the accuracy by including images taken from approximately 90 degrees to the left or right of the pear, in addition to the Depth images.
I tried modifying the code to accommodate these new images, but I’m facing some issues.
I would like to change the following points.
・The pear image uses the front, an image moved approximately 90 degrees to the left or right from the front, and a Depth image.
・I want to put all my data in a datastore.
Currently, the code listed is the code that I have modified, but in this state an error occurs and it is impossible to predict.Please lend me your strength.
cd ‘RGB front file path’
folder_name = pwd;
XImageTrainFront = imageDatastore(folder_name);
cd ‘RGB side file path’
folder_name = pwd;
XImageTrainSide = imageDatastore(folder_name);
cd ‘Depth file path’
folder_name = pwd;
XDispTrain = imageDatastore(folder_name);
YTrain = [ data ]; % weight labels
YTrain = arrayDatastore(YTrain);
% Combine datasets
ds = combine(XImageTrainFront, XImageTrainSide, XDispTrain, YTrain);
dsrand = shuffle(ds);
dsVali = partition(dsrand, 10, 1);
dsTest = partition(dsrand, 10, 2);
ds1=partition(dsrand,10,3);
ds2=partition(dsrand,10,4);
ds3=partition(dsrand,10,5);
ds4=partition(dsrand,10,6);
ds5=partition(dsrand,10,7);
ds6=partition(dsrand,10,8);
ds7=partition(dsrand,10,9);
ds8=partition(dsrand,10,10);
dsTrain=combine(ds1,ds2,ds3,ds4,ds5,ds6,ds7,ds8,ReadOrder="sequential");
YTest = readall(dsTest);
YTest = YTest(:,4);
YTest = cell2mat(YTest);
cd ‘path to googlenet300400_multiple.mat’
load googlenet300400_multiple.mat
miniBatchSize = 16;
options = trainingOptions(‘sgdm’, …
‘MiniBatchSize’, miniBatchSize, …
‘MaxEpochs’, 300, …
‘InitialLearnRate’, 1e-7, …
‘LearnRateSchedule’, ‘piecewise’, …
‘LearnRateDropFactor’, 0.1, …
‘LearnRateDropPeriod’, 30, …
‘Shuffle’, ‘every-epoch’, …
‘ValidationData’, dsVali, …
‘ValidationFrequency’, 50, …
‘Plots’, ‘training-progress’, …
‘Verbose’, true);
net = trainNetwork(dsTrain, lgraph_2, options);
YPredicted = predict(net, dsTest);
predictionError = YTest – YPredicted;
squares = predictionError.^2;
rmse = sqrt(mean(squares));
figure
scatter(YPredicted, YTest, ‘+’);
xlabel("Predicted Value");
ylabel("True Value");
hold on;
plot([100 550], [100 550], ‘r–‘);
Error message that occurred during modification.
Please respond to the following error. Error using: trainNetwork (line 191)
Invalid training data. The output size of the last layer ([1 1 1]) is the response size ([1 1 360000])
does not match.
Error: newcord2 (line 93)
net = trainNetwork(dsTrain, lgraph_2, options);
Error using: nnet.cnn.LayerGraph/replaceLayer (line 300)
Layer ‘finalLayerName’ does not exist.
Error: newcord2 (line 85)
lgraph_2 = replaceLayer(lgraph_2, ‘finalLayerName’, finalLayer); prediction, multi-input network, 予測, 多入力ネットワーク MATLAB Answers — New Questions
Trouble with for loop to determine the discrete wavelet transform (DWT)
Hi, I need assistance plotting the approximation (A) and detail (D) coefficients separately for all sheets in an Excel file over a given time frame. Currently, the existing code generates the transform only for the final sheet (Sheet 8). I am uncertain how to modify the code to plot A1 and D1 separately for all sheets. I would be grateful for any guidance you may provide. Thank you for your time and help.
clc
close all
clear all
filename = ‘s.xlsx’;
% Get the sheet names
[~, sheetNames] = xlsfinfo(filename);
for i = 1:numel(sheetNames)
% Read the data from the sheet
data = xlsread(filename, i);
% Extract the time and signal columns
t(:,i) = data(:, 1);
sig (:,i) = data(:, 2);
N = length(sig);
dt = t(3) – t(2); % sampling time
fs = 1/dt; % freq
signal = sig (:,i);
wname = ‘bior6.8’;
% Discrete Wavelet, DWT
[CA1,CD1] = dwt(signal,wname);
A1 = idwt(CA1,[],wname,N);
D1 = idwt([],CD1,wname,N);
t (:,i) = linspace(0,N,N)*(1/fs);
subplot(1,2,1);
plot (t,A1,’k’,’LineWidth’,1.5);
title(sprintf(‘Approximation for sheet%d’, i));
set(gca,’fontname’,’Times New Roman’,’FontSize’,10)
xlabel(‘Time (secs)’)
ylabel(‘Amplitude’)
grid on
subplot(1,2,2);
plot (t,D1,’k’,’LineWidth’,1.5);
title(sprintf(‘Detail for sheet%d’, i));
set(gca,’fontname’,’Times New Roman’,’FontSize’,10)
xlabel(‘Time (secs)’)
ylabel(‘Amplitude’)
grid on
endHi, I need assistance plotting the approximation (A) and detail (D) coefficients separately for all sheets in an Excel file over a given time frame. Currently, the existing code generates the transform only for the final sheet (Sheet 8). I am uncertain how to modify the code to plot A1 and D1 separately for all sheets. I would be grateful for any guidance you may provide. Thank you for your time and help.
clc
close all
clear all
filename = ‘s.xlsx’;
% Get the sheet names
[~, sheetNames] = xlsfinfo(filename);
for i = 1:numel(sheetNames)
% Read the data from the sheet
data = xlsread(filename, i);
% Extract the time and signal columns
t(:,i) = data(:, 1);
sig (:,i) = data(:, 2);
N = length(sig);
dt = t(3) – t(2); % sampling time
fs = 1/dt; % freq
signal = sig (:,i);
wname = ‘bior6.8’;
% Discrete Wavelet, DWT
[CA1,CD1] = dwt(signal,wname);
A1 = idwt(CA1,[],wname,N);
D1 = idwt([],CD1,wname,N);
t (:,i) = linspace(0,N,N)*(1/fs);
subplot(1,2,1);
plot (t,A1,’k’,’LineWidth’,1.5);
title(sprintf(‘Approximation for sheet%d’, i));
set(gca,’fontname’,’Times New Roman’,’FontSize’,10)
xlabel(‘Time (secs)’)
ylabel(‘Amplitude’)
grid on
subplot(1,2,2);
plot (t,D1,’k’,’LineWidth’,1.5);
title(sprintf(‘Detail for sheet%d’, i));
set(gca,’fontname’,’Times New Roman’,’FontSize’,10)
xlabel(‘Time (secs)’)
ylabel(‘Amplitude’)
grid on
end Hi, I need assistance plotting the approximation (A) and detail (D) coefficients separately for all sheets in an Excel file over a given time frame. Currently, the existing code generates the transform only for the final sheet (Sheet 8). I am uncertain how to modify the code to plot A1 and D1 separately for all sheets. I would be grateful for any guidance you may provide. Thank you for your time and help.
clc
close all
clear all
filename = ‘s.xlsx’;
% Get the sheet names
[~, sheetNames] = xlsfinfo(filename);
for i = 1:numel(sheetNames)
% Read the data from the sheet
data = xlsread(filename, i);
% Extract the time and signal columns
t(:,i) = data(:, 1);
sig (:,i) = data(:, 2);
N = length(sig);
dt = t(3) – t(2); % sampling time
fs = 1/dt; % freq
signal = sig (:,i);
wname = ‘bior6.8’;
% Discrete Wavelet, DWT
[CA1,CD1] = dwt(signal,wname);
A1 = idwt(CA1,[],wname,N);
D1 = idwt([],CD1,wname,N);
t (:,i) = linspace(0,N,N)*(1/fs);
subplot(1,2,1);
plot (t,A1,’k’,’LineWidth’,1.5);
title(sprintf(‘Approximation for sheet%d’, i));
set(gca,’fontname’,’Times New Roman’,’FontSize’,10)
xlabel(‘Time (secs)’)
ylabel(‘Amplitude’)
grid on
subplot(1,2,2);
plot (t,D1,’k’,’LineWidth’,1.5);
title(sprintf(‘Detail for sheet%d’, i));
set(gca,’fontname’,’Times New Roman’,’FontSize’,10)
xlabel(‘Time (secs)’)
ylabel(‘Amplitude’)
grid on
end dwt, plot, for loop MATLAB Answers — New Questions
Set up a native connection from Matlab to MySQL with SSL
I’m trying to use the native mysql interface to connect to a MySql 8.0.37 database on Azure. This database was previously deployed to a test server which didn’t require SSL and I was able to connect to it without issue. I’m also able to connect to the new Azure MySql database using DBeaver and the MySql Workbench from the same client computer, but I get the following error when I try to connect with Matlab’s mysql connector:
Error using mysql (line 49)
Connections using insecure transport are prohibited while –require_secure_transport=ON..
My connection code is as follows (where aosDbSettings is a struct containing the connection details):
conn = mysql( …
aosDbSettings.UserName, aosDbSettings.UserPassword, …
‘Server’, aosDbSettings.Server, …
‘DatabaseName’, aosDbSettings.DatabaseName, …
‘PortNumber’, aosDbSettings.PortNumber …
);
Having reviewed the documentation for the Native MySql Interface (specifically the mysql function), I don’t see any options related to SSL. Are there any undocumented options available to make this work? I find it surprising that there’s no mention of security options in the documentation. Am I missing something?I’m trying to use the native mysql interface to connect to a MySql 8.0.37 database on Azure. This database was previously deployed to a test server which didn’t require SSL and I was able to connect to it without issue. I’m also able to connect to the new Azure MySql database using DBeaver and the MySql Workbench from the same client computer, but I get the following error when I try to connect with Matlab’s mysql connector:
Error using mysql (line 49)
Connections using insecure transport are prohibited while –require_secure_transport=ON..
My connection code is as follows (where aosDbSettings is a struct containing the connection details):
conn = mysql( …
aosDbSettings.UserName, aosDbSettings.UserPassword, …
‘Server’, aosDbSettings.Server, …
‘DatabaseName’, aosDbSettings.DatabaseName, …
‘PortNumber’, aosDbSettings.PortNumber …
);
Having reviewed the documentation for the Native MySql Interface (specifically the mysql function), I don’t see any options related to SSL. Are there any undocumented options available to make this work? I find it surprising that there’s no mention of security options in the documentation. Am I missing something? I’m trying to use the native mysql interface to connect to a MySql 8.0.37 database on Azure. This database was previously deployed to a test server which didn’t require SSL and I was able to connect to it without issue. I’m also able to connect to the new Azure MySql database using DBeaver and the MySql Workbench from the same client computer, but I get the following error when I try to connect with Matlab’s mysql connector:
Error using mysql (line 49)
Connections using insecure transport are prohibited while –require_secure_transport=ON..
My connection code is as follows (where aosDbSettings is a struct containing the connection details):
conn = mysql( …
aosDbSettings.UserName, aosDbSettings.UserPassword, …
‘Server’, aosDbSettings.Server, …
‘DatabaseName’, aosDbSettings.DatabaseName, …
‘PortNumber’, aosDbSettings.PortNumber …
);
Having reviewed the documentation for the Native MySql Interface (specifically the mysql function), I don’t see any options related to SSL. Are there any undocumented options available to make this work? I find it surprising that there’s no mention of security options in the documentation. Am I missing something? mysql, ssl, database toolbox MATLAB Answers — New Questions
How to Curve the Lane
I want to show the straight and curved lanes on the roadrunner.
Is there a way to turn a straight lane into a curved lane?
Or is there a document or link to refer to?I want to show the straight and curved lanes on the roadrunner.
Is there a way to turn a straight lane into a curved lane?
Or is there a document or link to refer to? I want to show the straight and curved lanes on the roadrunner.
Is there a way to turn a straight lane into a curved lane?
Or is there a document or link to refer to? curve, roadrunner MATLAB Answers — New Questions
Failed to load a mesh from gptoolbox. I am missing something, what is it?
% 1. Load a Mesh
[V, F] = readOFF(‘D:Conferences and WorkshopsSG SummerMFC – Scodesgptoolbox-mastergptoolbox-mastermesh.off’);
% 2. Display the Mesh
figure;
trisurf(F, V(:,1), V(:,2), V(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
title(‘Original Mesh’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
% Define the number of iterations and timestep for smoothing
num_iterations = 100;
time_step = 0.01;
% 3. Mean Curvature Flow (MCF) – Explicit Method
V_explicit = V; % Copy the vertices for the explicit method
for iter = 1:num_iterations
% Compute the Laplace-Beltrami operator and mean curvature normal
L = cotmatrix(V_explicit, F);
HN = -L * V_explicit;
% Update vertex positions
V_explicit = V_explicit + time_step * HN;
end
% Display the smoothed mesh – Explicit Method
figure;
trisurf(F, V_explicit(:,1), V_explicit(:,2), V_explicit(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
title(‘MCF – Explicit Method’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
% 3. Mean Curvature Flow (MCF) – Semi-Implicit Method
V_implicit = V; % Copy the vertices for the implicit method
for iter = 1:num_iterations
% Compute the Laplace-Beltrami operator
L = cotmatrix(V_implicit, F);
% Solve (I – time_step * L) * V_new = V_old
V_implicit = (speye(size(V_implicit, 1)) – time_step * L) V_implicit;
end
% Display the smoothed mesh – Semi-Implicit Method
figure;
trisurf(F, V_implicit(:,1), V_implicit(:,2), V_implicit(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
title(‘MCF – Semi-Implicit Method’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
here is the link to loadmesh function: https://github.com/geometry-processing/gptoolbox/blob/master/mesh/load_mesh.m
and the readOFF: https://github.com/geometry-processing/gptoolbox/blob/master/mesh/readOFF.m% 1. Load a Mesh
[V, F] = readOFF(‘D:Conferences and WorkshopsSG SummerMFC – Scodesgptoolbox-mastergptoolbox-mastermesh.off’);
% 2. Display the Mesh
figure;
trisurf(F, V(:,1), V(:,2), V(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
title(‘Original Mesh’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
% Define the number of iterations and timestep for smoothing
num_iterations = 100;
time_step = 0.01;
% 3. Mean Curvature Flow (MCF) – Explicit Method
V_explicit = V; % Copy the vertices for the explicit method
for iter = 1:num_iterations
% Compute the Laplace-Beltrami operator and mean curvature normal
L = cotmatrix(V_explicit, F);
HN = -L * V_explicit;
% Update vertex positions
V_explicit = V_explicit + time_step * HN;
end
% Display the smoothed mesh – Explicit Method
figure;
trisurf(F, V_explicit(:,1), V_explicit(:,2), V_explicit(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
title(‘MCF – Explicit Method’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
% 3. Mean Curvature Flow (MCF) – Semi-Implicit Method
V_implicit = V; % Copy the vertices for the implicit method
for iter = 1:num_iterations
% Compute the Laplace-Beltrami operator
L = cotmatrix(V_implicit, F);
% Solve (I – time_step * L) * V_new = V_old
V_implicit = (speye(size(V_implicit, 1)) – time_step * L) V_implicit;
end
% Display the smoothed mesh – Semi-Implicit Method
figure;
trisurf(F, V_implicit(:,1), V_implicit(:,2), V_implicit(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
title(‘MCF – Semi-Implicit Method’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
here is the link to loadmesh function: https://github.com/geometry-processing/gptoolbox/blob/master/mesh/load_mesh.m
and the readOFF: https://github.com/geometry-processing/gptoolbox/blob/master/mesh/readOFF.m % 1. Load a Mesh
[V, F] = readOFF(‘D:Conferences and WorkshopsSG SummerMFC – Scodesgptoolbox-mastergptoolbox-mastermesh.off’);
% 2. Display the Mesh
figure;
trisurf(F, V(:,1), V(:,2), V(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
title(‘Original Mesh’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
% Define the number of iterations and timestep for smoothing
num_iterations = 100;
time_step = 0.01;
% 3. Mean Curvature Flow (MCF) – Explicit Method
V_explicit = V; % Copy the vertices for the explicit method
for iter = 1:num_iterations
% Compute the Laplace-Beltrami operator and mean curvature normal
L = cotmatrix(V_explicit, F);
HN = -L * V_explicit;
% Update vertex positions
V_explicit = V_explicit + time_step * HN;
end
% Display the smoothed mesh – Explicit Method
figure;
trisurf(F, V_explicit(:,1), V_explicit(:,2), V_explicit(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
title(‘MCF – Explicit Method’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
% 3. Mean Curvature Flow (MCF) – Semi-Implicit Method
V_implicit = V; % Copy the vertices for the implicit method
for iter = 1:num_iterations
% Compute the Laplace-Beltrami operator
L = cotmatrix(V_implicit, F);
% Solve (I – time_step * L) * V_new = V_old
V_implicit = (speye(size(V_implicit, 1)) – time_step * L) V_implicit;
end
% Display the smoothed mesh – Semi-Implicit Method
figure;
trisurf(F, V_implicit(:,1), V_implicit(:,2), V_implicit(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
title(‘MCF – Semi-Implicit Method’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
here is the link to loadmesh function: https://github.com/geometry-processing/gptoolbox/blob/master/mesh/load_mesh.m
and the readOFF: https://github.com/geometry-processing/gptoolbox/blob/master/mesh/readOFF.m gpu, gp, image processing, mesh MATLAB Answers — New Questions
Can’t connect branch with block in simulink
Hello.
I made a circuit for superposition theorem in simulink with dc voltage source and the measured current is connected to the scope as an output so i can see the value.My next task is to simulate the work of this circuit. When i try to drag & connect the branch with the input of the current measurement block then it is showing red dashed line which means that i cannot connect it to my circuit.
Please someone help me solve this problem, it is a bit urgent.
Thank you!Hello.
I made a circuit for superposition theorem in simulink with dc voltage source and the measured current is connected to the scope as an output so i can see the value.My next task is to simulate the work of this circuit. When i try to drag & connect the branch with the input of the current measurement block then it is showing red dashed line which means that i cannot connect it to my circuit.
Please someone help me solve this problem, it is a bit urgent.
Thank you! Hello.
I made a circuit for superposition theorem in simulink with dc voltage source and the measured current is connected to the scope as an output so i can see the value.My next task is to simulate the work of this circuit. When i try to drag & connect the branch with the input of the current measurement block then it is showing red dashed line which means that i cannot connect it to my circuit.
Please someone help me solve this problem, it is a bit urgent.
Thank you! superposition theorem, block connection MATLAB Answers — New Questions