Category: Matlab
Category Archives: Matlab
How can I develop a matlab code that used to fine the phase profile of a Reconfigurable intelligent surface? with contains a beamforming algorithm to locate the received wave
The code with a beamforming algorithm
How can I get the sample values for the input and output values
Create the RIS by defining its size, position, and reflection coefficients
equation to calculate the reflected waveThe code with a beamforming algorithm
How can I get the sample values for the input and output values
Create the RIS by defining its size, position, and reflection coefficients
equation to calculate the reflected wave The code with a beamforming algorithm
How can I get the sample values for the input and output values
Create the RIS by defining its size, position, and reflection coefficients
equation to calculate the reflected wave #ris, beamform MATLAB Answers — New Questions
Arduino Uno and Matlab Simulink using IR sensor and LCD I2C display only
Hi,
I’m building my project with Arduino Uno and Matlab Simulink using IR sensor and LCD I2C display only. In my project, My concept is that I want the IR sensor to detect the object and the I2c display to start the counting in seconds. If the sensor detects another object, the counting should stop immediately.
if any could help, thnks in advancedHi,
I’m building my project with Arduino Uno and Matlab Simulink using IR sensor and LCD I2C display only. In my project, My concept is that I want the IR sensor to detect the object and the I2c display to start the counting in seconds. If the sensor detects another object, the counting should stop immediately.
if any could help, thnks in advanced Hi,
I’m building my project with Arduino Uno and Matlab Simulink using IR sensor and LCD I2C display only. In my project, My concept is that I want the IR sensor to detect the object and the I2c display to start the counting in seconds. If the sensor detects another object, the counting should stop immediately.
if any could help, thnks in advanced ir_sensor, simulink MATLAB Answers — New Questions
How do I extract column name of table in MATLAB?
Can you suggest me a way to extract name of specific column of table in MATLAB?Can you suggest me a way to extract name of specific column of table in MATLAB? Can you suggest me a way to extract name of specific column of table in MATLAB? table, uitable MATLAB Answers — New Questions
Using Simulink for Solver use
Hello Matlab,
I have taken the help of last advise given by Matlab. I found out navigation etc. My issue currently is:
I have uploaded one file to Matlab Drive.
In the Simulink, I tried to import data. It did not work but there in the drive.
Then I clicked on New Script, pasted script and Saved it. But nothings happening when I clicked on RUN button.
My need is, I have a mathematical model, non linear, in the excel. The script defines Objective functions, Variable cells and Constraints. This was AI generated. I wanted to optimise that. Is there an alternative to script and if not, can I have tutorials on how to write a Matlab code for : Objective functions, Variable cells and Constraints?
Regards.Hello Matlab,
I have taken the help of last advise given by Matlab. I found out navigation etc. My issue currently is:
I have uploaded one file to Matlab Drive.
In the Simulink, I tried to import data. It did not work but there in the drive.
Then I clicked on New Script, pasted script and Saved it. But nothings happening when I clicked on RUN button.
My need is, I have a mathematical model, non linear, in the excel. The script defines Objective functions, Variable cells and Constraints. This was AI generated. I wanted to optimise that. Is there an alternative to script and if not, can I have tutorials on how to write a Matlab code for : Objective functions, Variable cells and Constraints?
Regards. Hello Matlab,
I have taken the help of last advise given by Matlab. I found out navigation etc. My issue currently is:
I have uploaded one file to Matlab Drive.
In the Simulink, I tried to import data. It did not work but there in the drive.
Then I clicked on New Script, pasted script and Saved it. But nothings happening when I clicked on RUN button.
My need is, I have a mathematical model, non linear, in the excel. The script defines Objective functions, Variable cells and Constraints. This was AI generated. I wanted to optimise that. Is there an alternative to script and if not, can I have tutorials on how to write a Matlab code for : Objective functions, Variable cells and Constraints?
Regards. solver MATLAB Answers — New Questions
How to remove noise of low frequency signals
Hello,
I have to create a model of following signal in such a way a way that red signal will not fluctuate with the green signal and will always take mean of green signal. I have used moving average filter, but still there is some fluctuation, I cannot increase N of moving average filter, since it will make it less responsive. Could you suggest me such a way where I could make red signals more or less like straight tine. is there any filter or algorithm available for this.
Note – this signal manipulation should be done in realtime, model is created in SimulinkHello,
I have to create a model of following signal in such a way a way that red signal will not fluctuate with the green signal and will always take mean of green signal. I have used moving average filter, but still there is some fluctuation, I cannot increase N of moving average filter, since it will make it less responsive. Could you suggest me such a way where I could make red signals more or less like straight tine. is there any filter or algorithm available for this.
Note – this signal manipulation should be done in realtime, model is created in Simulink Hello,
I have to create a model of following signal in such a way a way that red signal will not fluctuate with the green signal and will always take mean of green signal. I have used moving average filter, but still there is some fluctuation, I cannot increase N of moving average filter, since it will make it less responsive. Could you suggest me such a way where I could make red signals more or less like straight tine. is there any filter or algorithm available for this.
Note – this signal manipulation should be done in realtime, model is created in Simulink filter, low frequency, signal processing MATLAB Answers — New Questions
for double for loop error
syms x t%a g d l1 m1
%%%%%%%%%%%%%%%% Fractional Order%
alpha=2;
beta=1;
%%%%%%%%%%%% initilization of variable%%%%%%
U=zeros(1,2,’sym’);
V=zeros(1,2,’sym’);
A=zeros(1,2,’sym’);
B=zeros(1,2,’sym’);
C=zeros(1,2,’sym’);
D=zeros(1,2,’sym’);
E=zeros(1,2,’sym’);
F=zeros(1,2,’sym’);
G=zeros(1,2,’sym’);
series1(x,t)=sym(zeros(1,1));
series2(x,t)=sym(zeros(1,1));
a=1;
g=0.01;
d=0.01;
l1=-(4/9)*g^4*d+(16/27)*g^6-(5/9)*g^2*d^2-(5/54)*d^3;
m1=20*g^4*d-16*g^6+5*g^2*d^2;
U(1)=a-2*g*cot(g*x);
U(2)=-2*g^2*d*csc(g*x)*csc(g*x);
V(1)=l1-(1/9)*m1*cot(g*x)*cot(g*x);
for k=1:3
A(1)=0;
B(1)=0;
C(1)=0;
D(1)=0;
E(1)=0;
F(1)=0;
G(1)=0;
for r=1:k
A(1)=A(1)+diff(U(r),x,2)*diff(U(k-r+1),x,3);
B(1)=B(1)+diff(U(r),x,1)*diff(U(k-r+1),x,4);
D(1)=D(1)+diff(U(r),x,2)*(k-r+1)*U(k-r+1);
E(1)=E(1)+diff(U(r),x,1)*(k-r+1)*diff(U(k-r+1),x,1);
F(1)=F(1)+diff(V(r),x,1)*diff(U(k-r+1),x,1);
G(1)=G(1)+V(r)*diff(U(k-r+1),x,2);
for l=1:r
C(1)=C(1)+diff(U(l),x,1)*diff(U(r-l+1),x,1)*diff(U(k-r+1),x,2);% 4th term
end
end
U(k+2)=gamma(((k-1)*alpha)+1)/gamma((alpha*(k+1-1))+1)*((1/5)*diff(U(k),x,6)+3*A(1)+3*B(1)+9*C(1)-(k)*diff(U(k+1),x,2)-3*D(1)-3*E(1)+(18/5)*diff(V(k),x,1))
V(k+1)=gamma(((k-1)*beta)+1)/gamma((beta*(k+1-1))+1)*(diff(V(k),x,3)+3*F(1)+3*G(1));
end
for k=1:2
series1(x,t)=simplify(series1(x,t)+U(k)*power(t,k-1));
series2(x,t)=simplify(series2(x,t)+V(k)*power(t,k-1));
end
series1
series2
row=0
for r=1:10:110
row=row+1;
col=0;
e=r-1
for t=1
col=col+1;
f=t+19
C1(row,col)=series1(e,f);
C2(row,col)=series2(e,f);
end
end
vpa(C1,15)
vpa(C2,15)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x=10:10:100
t=20
row=0
for i=1:length(x)
row=row+1
col=col+1
for j=1:length(t)
C1(row, col) =series1(x(i), t(i))
C2(row,col) =series2(x(i),t(i))
end
end
This two for loop shows thw different value of C1 and C2 . The first for loop gives the correct value for C1 but not C2. But the second loop give both wrong
.
I want know the value of x anf t are same then why for loop show two different valuesyms x t%a g d l1 m1
%%%%%%%%%%%%%%%% Fractional Order%
alpha=2;
beta=1;
%%%%%%%%%%%% initilization of variable%%%%%%
U=zeros(1,2,’sym’);
V=zeros(1,2,’sym’);
A=zeros(1,2,’sym’);
B=zeros(1,2,’sym’);
C=zeros(1,2,’sym’);
D=zeros(1,2,’sym’);
E=zeros(1,2,’sym’);
F=zeros(1,2,’sym’);
G=zeros(1,2,’sym’);
series1(x,t)=sym(zeros(1,1));
series2(x,t)=sym(zeros(1,1));
a=1;
g=0.01;
d=0.01;
l1=-(4/9)*g^4*d+(16/27)*g^6-(5/9)*g^2*d^2-(5/54)*d^3;
m1=20*g^4*d-16*g^6+5*g^2*d^2;
U(1)=a-2*g*cot(g*x);
U(2)=-2*g^2*d*csc(g*x)*csc(g*x);
V(1)=l1-(1/9)*m1*cot(g*x)*cot(g*x);
for k=1:3
A(1)=0;
B(1)=0;
C(1)=0;
D(1)=0;
E(1)=0;
F(1)=0;
G(1)=0;
for r=1:k
A(1)=A(1)+diff(U(r),x,2)*diff(U(k-r+1),x,3);
B(1)=B(1)+diff(U(r),x,1)*diff(U(k-r+1),x,4);
D(1)=D(1)+diff(U(r),x,2)*(k-r+1)*U(k-r+1);
E(1)=E(1)+diff(U(r),x,1)*(k-r+1)*diff(U(k-r+1),x,1);
F(1)=F(1)+diff(V(r),x,1)*diff(U(k-r+1),x,1);
G(1)=G(1)+V(r)*diff(U(k-r+1),x,2);
for l=1:r
C(1)=C(1)+diff(U(l),x,1)*diff(U(r-l+1),x,1)*diff(U(k-r+1),x,2);% 4th term
end
end
U(k+2)=gamma(((k-1)*alpha)+1)/gamma((alpha*(k+1-1))+1)*((1/5)*diff(U(k),x,6)+3*A(1)+3*B(1)+9*C(1)-(k)*diff(U(k+1),x,2)-3*D(1)-3*E(1)+(18/5)*diff(V(k),x,1))
V(k+1)=gamma(((k-1)*beta)+1)/gamma((beta*(k+1-1))+1)*(diff(V(k),x,3)+3*F(1)+3*G(1));
end
for k=1:2
series1(x,t)=simplify(series1(x,t)+U(k)*power(t,k-1));
series2(x,t)=simplify(series2(x,t)+V(k)*power(t,k-1));
end
series1
series2
row=0
for r=1:10:110
row=row+1;
col=0;
e=r-1
for t=1
col=col+1;
f=t+19
C1(row,col)=series1(e,f);
C2(row,col)=series2(e,f);
end
end
vpa(C1,15)
vpa(C2,15)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x=10:10:100
t=20
row=0
for i=1:length(x)
row=row+1
col=col+1
for j=1:length(t)
C1(row, col) =series1(x(i), t(i))
C2(row,col) =series2(x(i),t(i))
end
end
This two for loop shows thw different value of C1 and C2 . The first for loop gives the correct value for C1 but not C2. But the second loop give both wrong
.
I want know the value of x anf t are same then why for loop show two different value syms x t%a g d l1 m1
%%%%%%%%%%%%%%%% Fractional Order%
alpha=2;
beta=1;
%%%%%%%%%%%% initilization of variable%%%%%%
U=zeros(1,2,’sym’);
V=zeros(1,2,’sym’);
A=zeros(1,2,’sym’);
B=zeros(1,2,’sym’);
C=zeros(1,2,’sym’);
D=zeros(1,2,’sym’);
E=zeros(1,2,’sym’);
F=zeros(1,2,’sym’);
G=zeros(1,2,’sym’);
series1(x,t)=sym(zeros(1,1));
series2(x,t)=sym(zeros(1,1));
a=1;
g=0.01;
d=0.01;
l1=-(4/9)*g^4*d+(16/27)*g^6-(5/9)*g^2*d^2-(5/54)*d^3;
m1=20*g^4*d-16*g^6+5*g^2*d^2;
U(1)=a-2*g*cot(g*x);
U(2)=-2*g^2*d*csc(g*x)*csc(g*x);
V(1)=l1-(1/9)*m1*cot(g*x)*cot(g*x);
for k=1:3
A(1)=0;
B(1)=0;
C(1)=0;
D(1)=0;
E(1)=0;
F(1)=0;
G(1)=0;
for r=1:k
A(1)=A(1)+diff(U(r),x,2)*diff(U(k-r+1),x,3);
B(1)=B(1)+diff(U(r),x,1)*diff(U(k-r+1),x,4);
D(1)=D(1)+diff(U(r),x,2)*(k-r+1)*U(k-r+1);
E(1)=E(1)+diff(U(r),x,1)*(k-r+1)*diff(U(k-r+1),x,1);
F(1)=F(1)+diff(V(r),x,1)*diff(U(k-r+1),x,1);
G(1)=G(1)+V(r)*diff(U(k-r+1),x,2);
for l=1:r
C(1)=C(1)+diff(U(l),x,1)*diff(U(r-l+1),x,1)*diff(U(k-r+1),x,2);% 4th term
end
end
U(k+2)=gamma(((k-1)*alpha)+1)/gamma((alpha*(k+1-1))+1)*((1/5)*diff(U(k),x,6)+3*A(1)+3*B(1)+9*C(1)-(k)*diff(U(k+1),x,2)-3*D(1)-3*E(1)+(18/5)*diff(V(k),x,1))
V(k+1)=gamma(((k-1)*beta)+1)/gamma((beta*(k+1-1))+1)*(diff(V(k),x,3)+3*F(1)+3*G(1));
end
for k=1:2
series1(x,t)=simplify(series1(x,t)+U(k)*power(t,k-1));
series2(x,t)=simplify(series2(x,t)+V(k)*power(t,k-1));
end
series1
series2
row=0
for r=1:10:110
row=row+1;
col=0;
e=r-1
for t=1
col=col+1;
f=t+19
C1(row,col)=series1(e,f);
C2(row,col)=series2(e,f);
end
end
vpa(C1,15)
vpa(C2,15)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x=10:10:100
t=20
row=0
for i=1:length(x)
row=row+1
col=col+1
for j=1:length(t)
C1(row, col) =series1(x(i), t(i))
C2(row,col) =series2(x(i),t(i))
end
end
This two for loop shows thw different value of C1 and C2 . The first for loop gives the correct value for C1 but not C2. But the second loop give both wrong
.
I want know the value of x anf t are same then why for loop show two different value for loop error MATLAB Answers — New Questions
Problem with matrix dimensions
Hello, my code is giving me the error :
Error using
Matrix dimensions must agree.
I don’t know why because the matrices I am trying to divide have the dimensions of 5×1 and 5×5
function F = sistema(X)
beta1 = 0.0000009;
beta2 = 0.00000093;
M = 1;
p = 0.1;
mu = 0.00001;
rho = 0.00002;
theta = 0.005;
omega = 0.05;
gamma = 0.001;
alpha1 = 0.0001;
alpha2 = 0.004;
S = X(1);
E = X(2);
I = X(3);
Q = X(4);
V = X(5);
F(1) = p*M – beta1*S*E – beta2*S*I – (rho + mu)*S;
F(2) = beta1*S*E + beta2*S*I – (omega + alpha1 + mu)*E;
F(3) = omega*E – (gamma + alpha2 + mu)*I;
F(4) = alpha1*E + alpha2*I – (theta + mu)*Q;
F(5) = (1 – p)*M + rho*S + gamma*I + theta*Q – mu*V;
end
function JF = jacobiano(X)
beta1 = 0.0000009;
beta2 = 0.00000093;
M = 1;
p = 0.1;
mu = 0.00001;
rho = 0.00002;
theta = 0.005;
omega = 0.05;
gamma = 0.001;
alpha1 = 0.0001;
alpha2 = 0.004;
S = X(1);
E = X(2);
I = X(3);
Q = X(4);
V = X(5);
JF = [-beta1*E – beta2*I – rho – mu, -beta1*S, -beta2*S, 0, 0;
beta1*E, beta1*S – (omega + alpha1 + mu), beta2*S, 0, 0;
0, omega, -(gamma + alpha2 + mu), 0, 0;
0, alpha1, alpha2, -(theta + mu), 0;
rho, 0, gamma, theta, -mu];
end
These are the codes of the two functions that qive the matrices
function [x, it, norma_diferenca] = metodo_newton2(F, JF, y0, e, nmax)
x = y0;
it = 0;
norma_diferenca = Inf;
while norma_diferenca > e && it < nmax
Fx = F(x);
JFx = JF(x);
div = JFx (-Fx);
x = x + div;
norma_diferenca = norm(div);
it = it + 1;
end
if it >= nmax
disp(‘Atingido o número máximo de iterações sem convergência.’);
end
end
And this is the code taht divide the two matrices.Hello, my code is giving me the error :
Error using
Matrix dimensions must agree.
I don’t know why because the matrices I am trying to divide have the dimensions of 5×1 and 5×5
function F = sistema(X)
beta1 = 0.0000009;
beta2 = 0.00000093;
M = 1;
p = 0.1;
mu = 0.00001;
rho = 0.00002;
theta = 0.005;
omega = 0.05;
gamma = 0.001;
alpha1 = 0.0001;
alpha2 = 0.004;
S = X(1);
E = X(2);
I = X(3);
Q = X(4);
V = X(5);
F(1) = p*M – beta1*S*E – beta2*S*I – (rho + mu)*S;
F(2) = beta1*S*E + beta2*S*I – (omega + alpha1 + mu)*E;
F(3) = omega*E – (gamma + alpha2 + mu)*I;
F(4) = alpha1*E + alpha2*I – (theta + mu)*Q;
F(5) = (1 – p)*M + rho*S + gamma*I + theta*Q – mu*V;
end
function JF = jacobiano(X)
beta1 = 0.0000009;
beta2 = 0.00000093;
M = 1;
p = 0.1;
mu = 0.00001;
rho = 0.00002;
theta = 0.005;
omega = 0.05;
gamma = 0.001;
alpha1 = 0.0001;
alpha2 = 0.004;
S = X(1);
E = X(2);
I = X(3);
Q = X(4);
V = X(5);
JF = [-beta1*E – beta2*I – rho – mu, -beta1*S, -beta2*S, 0, 0;
beta1*E, beta1*S – (omega + alpha1 + mu), beta2*S, 0, 0;
0, omega, -(gamma + alpha2 + mu), 0, 0;
0, alpha1, alpha2, -(theta + mu), 0;
rho, 0, gamma, theta, -mu];
end
These are the codes of the two functions that qive the matrices
function [x, it, norma_diferenca] = metodo_newton2(F, JF, y0, e, nmax)
x = y0;
it = 0;
norma_diferenca = Inf;
while norma_diferenca > e && it < nmax
Fx = F(x);
JFx = JF(x);
div = JFx (-Fx);
x = x + div;
norma_diferenca = norm(div);
it = it + 1;
end
if it >= nmax
disp(‘Atingido o número máximo de iterações sem convergência.’);
end
end
And this is the code taht divide the two matrices. Hello, my code is giving me the error :
Error using
Matrix dimensions must agree.
I don’t know why because the matrices I am trying to divide have the dimensions of 5×1 and 5×5
function F = sistema(X)
beta1 = 0.0000009;
beta2 = 0.00000093;
M = 1;
p = 0.1;
mu = 0.00001;
rho = 0.00002;
theta = 0.005;
omega = 0.05;
gamma = 0.001;
alpha1 = 0.0001;
alpha2 = 0.004;
S = X(1);
E = X(2);
I = X(3);
Q = X(4);
V = X(5);
F(1) = p*M – beta1*S*E – beta2*S*I – (rho + mu)*S;
F(2) = beta1*S*E + beta2*S*I – (omega + alpha1 + mu)*E;
F(3) = omega*E – (gamma + alpha2 + mu)*I;
F(4) = alpha1*E + alpha2*I – (theta + mu)*Q;
F(5) = (1 – p)*M + rho*S + gamma*I + theta*Q – mu*V;
end
function JF = jacobiano(X)
beta1 = 0.0000009;
beta2 = 0.00000093;
M = 1;
p = 0.1;
mu = 0.00001;
rho = 0.00002;
theta = 0.005;
omega = 0.05;
gamma = 0.001;
alpha1 = 0.0001;
alpha2 = 0.004;
S = X(1);
E = X(2);
I = X(3);
Q = X(4);
V = X(5);
JF = [-beta1*E – beta2*I – rho – mu, -beta1*S, -beta2*S, 0, 0;
beta1*E, beta1*S – (omega + alpha1 + mu), beta2*S, 0, 0;
0, omega, -(gamma + alpha2 + mu), 0, 0;
0, alpha1, alpha2, -(theta + mu), 0;
rho, 0, gamma, theta, -mu];
end
These are the codes of the two functions that qive the matrices
function [x, it, norma_diferenca] = metodo_newton2(F, JF, y0, e, nmax)
x = y0;
it = 0;
norma_diferenca = Inf;
while norma_diferenca > e && it < nmax
Fx = F(x);
JFx = JF(x);
div = JFx (-Fx);
x = x + div;
norma_diferenca = norm(div);
it = it + 1;
end
if it >= nmax
disp(‘Atingido o número máximo de iterações sem convergência.’);
end
end
And this is the code taht divide the two matrices. matlab, matrices, division MATLAB Answers — New Questions
How to save videos in a MATALB standalone application?
I am trying to build a standalone application using MATLAB App Designer. In that, I want to play videos according to the given instructions or keywords. Those videos are saved on my desktop. How should I proceed in building the standalone application so that to play these videos after installing the application on any other target desktop system (without having/saving the videos on the target system)?
Can anyone suggest some way out?
Feel free to comment if my query is not clearI am trying to build a standalone application using MATLAB App Designer. In that, I want to play videos according to the given instructions or keywords. Those videos are saved on my desktop. How should I proceed in building the standalone application so that to play these videos after installing the application on any other target desktop system (without having/saving the videos on the target system)?
Can anyone suggest some way out?
Feel free to comment if my query is not clear I am trying to build a standalone application using MATLAB App Designer. In that, I want to play videos according to the given instructions or keywords. Those videos are saved on my desktop. How should I proceed in building the standalone application so that to play these videos after installing the application on any other target desktop system (without having/saving the videos on the target system)?
Can anyone suggest some way out?
Feel free to comment if my query is not clear appdesigner, matlab, app designer, matlab gui MATLAB Answers — New Questions
Calculating Surface Curvature from Image Data
Hello,
I’m trying to calculate the curvature of each surface point from a morphology picture. However, when using surfature(), I do not get the results I want. A lot of points have a gaussian curvature of 0, which is not plausible for the example I use.
I tried a lot of different methods for calculating and ploting, but never got a good result…
I wrote the following:
% reading in picture
data = imread("Morphology.PNG");
% if not yet, convert to gray image
if size(data, 3) == 3
data = rgb2gray(data);
end
% smoothing image
data = imgaussfilt(data, 4);
% converting to double
data = double(data);
z = data;
% generating 2D arrays for X and Y with size of data-dimensions
[Rows, Cols] = size(data);
[x, y] = meshgrid(1:Cols, 1:Rows);
% calculating gaussian and normal curvature
[K, H] = surfature(x, y, data);
% display surface
figure;
surf(x, y, z, "EdgeColor","none");
title(‘Surface Morphology’);
colorbar;
% ploting the results
figure;
surf(x, y, z, K, "EdgeColor","none");
title(‘3D Surface Gaussian Curvature Map’);
colorbar;
disp(K);Hello,
I’m trying to calculate the curvature of each surface point from a morphology picture. However, when using surfature(), I do not get the results I want. A lot of points have a gaussian curvature of 0, which is not plausible for the example I use.
I tried a lot of different methods for calculating and ploting, but never got a good result…
I wrote the following:
% reading in picture
data = imread("Morphology.PNG");
% if not yet, convert to gray image
if size(data, 3) == 3
data = rgb2gray(data);
end
% smoothing image
data = imgaussfilt(data, 4);
% converting to double
data = double(data);
z = data;
% generating 2D arrays for X and Y with size of data-dimensions
[Rows, Cols] = size(data);
[x, y] = meshgrid(1:Cols, 1:Rows);
% calculating gaussian and normal curvature
[K, H] = surfature(x, y, data);
% display surface
figure;
surf(x, y, z, "EdgeColor","none");
title(‘Surface Morphology’);
colorbar;
% ploting the results
figure;
surf(x, y, z, K, "EdgeColor","none");
title(‘3D Surface Gaussian Curvature Map’);
colorbar;
disp(K); Hello,
I’m trying to calculate the curvature of each surface point from a morphology picture. However, when using surfature(), I do not get the results I want. A lot of points have a gaussian curvature of 0, which is not plausible for the example I use.
I tried a lot of different methods for calculating and ploting, but never got a good result…
I wrote the following:
% reading in picture
data = imread("Morphology.PNG");
% if not yet, convert to gray image
if size(data, 3) == 3
data = rgb2gray(data);
end
% smoothing image
data = imgaussfilt(data, 4);
% converting to double
data = double(data);
z = data;
% generating 2D arrays for X and Y with size of data-dimensions
[Rows, Cols] = size(data);
[x, y] = meshgrid(1:Cols, 1:Rows);
% calculating gaussian and normal curvature
[K, H] = surfature(x, y, data);
% display surface
figure;
surf(x, y, z, "EdgeColor","none");
title(‘Surface Morphology’);
colorbar;
% ploting the results
figure;
surf(x, y, z, K, "EdgeColor","none");
title(‘3D Surface Gaussian Curvature Map’);
colorbar;
disp(K); surfature, surface, curvature, image processing MATLAB Answers — New Questions
“Application install was not successful” when trying to install Matlab app
When trying to install an app (compiled app designer app) I’m receiving ""Application install was not successful".
I have tested:
Several different installers/apps (all have previously worked and works on other systems)
Uninstalled and reinstalled both Matlab and Matlab runtime
Cleared the Matlab folders in AppData Local and Roaming
Rebooted my system
Verified that there are no remaining files in the installation directory from previous installs.
Booting the .exe installer from various locations
After booting the installer .exe I get to the Windows User Account Control. After accepting, the matlab installer window flashes up shortly before presenting the below message.
Any suggestions on how to proceed?When trying to install an app (compiled app designer app) I’m receiving ""Application install was not successful".
I have tested:
Several different installers/apps (all have previously worked and works on other systems)
Uninstalled and reinstalled both Matlab and Matlab runtime
Cleared the Matlab folders in AppData Local and Roaming
Rebooted my system
Verified that there are no remaining files in the installation directory from previous installs.
Booting the .exe installer from various locations
After booting the installer .exe I get to the Windows User Account Control. After accepting, the matlab installer window flashes up shortly before presenting the below message.
Any suggestions on how to proceed? When trying to install an app (compiled app designer app) I’m receiving ""Application install was not successful".
I have tested:
Several different installers/apps (all have previously worked and works on other systems)
Uninstalled and reinstalled both Matlab and Matlab runtime
Cleared the Matlab folders in AppData Local and Roaming
Rebooted my system
Verified that there are no remaining files in the installation directory from previous installs.
Booting the .exe installer from various locations
After booting the installer .exe I get to the Windows User Account Control. After accepting, the matlab installer window flashes up shortly before presenting the below message.
Any suggestions on how to proceed? matlab app installer, installer, matlab application, application install was not successful MATLAB Answers — New Questions
How can I connect matlab with MAXM86146?
I would analyze the data of MAXM86146I would analyze the data of MAXM86146 I would analyze the data of MAXM86146 sofware, maxm86146 MATLAB Answers — New Questions
How to integrate system GPU with MATLAB?
Hi,
Aatually, I am working on deep learning project. I am train a custom model with different pretrained model. While I am training it take too much time to train a model. So, I go throught with gpu but I saw it’s support on nvidia gpu. And I have 8GB intel GPU on my system but I am uable to integrate with MATLAB. Could you please help to integrate GPU with MATLAB.Hi,
Aatually, I am working on deep learning project. I am train a custom model with different pretrained model. While I am training it take too much time to train a model. So, I go throught with gpu but I saw it’s support on nvidia gpu. And I have 8GB intel GPU on my system but I am uable to integrate with MATLAB. Could you please help to integrate GPU with MATLAB. Hi,
Aatually, I am working on deep learning project. I am train a custom model with different pretrained model. While I am training it take too much time to train a model. So, I go throught with gpu but I saw it’s support on nvidia gpu. And I have 8GB intel GPU on my system but I am uable to integrate with MATLAB. Could you please help to integrate GPU with MATLAB. image processing, deep learning, gpu, intel MATLAB Answers — New Questions
Triangulation of hollow objects
Hi all,
simply, how to make the simple hollow 3D triangle depicted below?
Is there some contraint method I could use instead? I use the following command to get the surface:
tri = triangulation(delaunay(x,y),x,y,z);Hi all,
simply, how to make the simple hollow 3D triangle depicted below?
Is there some contraint method I could use instead? I use the following command to get the surface:
tri = triangulation(delaunay(x,y),x,y,z); Hi all,
simply, how to make the simple hollow 3D triangle depicted below?
Is there some contraint method I could use instead? I use the following command to get the surface:
tri = triangulation(delaunay(x,y),x,y,z); delaunay, triangulation MATLAB Answers — New Questions
how print multiple values on screen in one line in matlab
I am doing image image processing in matlab , so if many object will be detected at once, then i want multiple vallues in at once in one line . I mean I will be getting cordinates of every box which is detected .I am doing image image processing in matlab , so if many object will be detected at once, then i want multiple vallues in at once in one line . I mean I will be getting cordinates of every box which is detected . I am doing image image processing in matlab , so if many object will be detected at once, then i want multiple vallues in at once in one line . I mean I will be getting cordinates of every box which is detected . image processing, fprintf MATLAB Answers — New Questions
How to connect MATLAB on windows OS to Clickhouse database server on a cloud Linux virtual machine?
Hi,
My computations are stored in a Clickhouse databse server on a Linux (Ubuntu) virtual machine (VM). I would like to access the data from the Clickhouse server on the VM to MATLAB in my local machine on windows OS, so that I can process the data locally.
I tried to explore the database tool box, but since I am new to this, I haven’t been able to connect to the database on the VM.
I would appreciate pointers from the experts.
Thanks in advance.Hi,
My computations are stored in a Clickhouse databse server on a Linux (Ubuntu) virtual machine (VM). I would like to access the data from the Clickhouse server on the VM to MATLAB in my local machine on windows OS, so that I can process the data locally.
I tried to explore the database tool box, but since I am new to this, I haven’t been able to connect to the database on the VM.
I would appreciate pointers from the experts.
Thanks in advance. Hi,
My computations are stored in a Clickhouse databse server on a Linux (Ubuntu) virtual machine (VM). I would like to access the data from the Clickhouse server on the VM to MATLAB in my local machine on windows OS, so that I can process the data locally.
I tried to explore the database tool box, but since I am new to this, I haven’t been able to connect to the database on the VM.
I would appreciate pointers from the experts.
Thanks in advance. database, clickhouse MATLAB Answers — New Questions
Error using barrier Objective function is undefined at initial point. Fmincon cannot continue.Error in Calibration (line 161) [x, fval ] = fmincon(GGG, x0, A, b, Aeq, beq, lb,
Hello,
Please can someone help me solve this issue. I keep getting the below error. Attached also is my matlab codes.
Thanks,
Celestine.
>> Calibration
Error using barrier
Objective function is undefined at initial point. Fmincon cannot continue.
Error in fmincon (line 861)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] =
barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, …
Error in Calibration (line 161)
[x, fval ] = fmincon(GGG, x0, A, b, Aeq, beq, lb, ub, nonlcon, opts);Hello,
Please can someone help me solve this issue. I keep getting the below error. Attached also is my matlab codes.
Thanks,
Celestine.
>> Calibration
Error using barrier
Objective function is undefined at initial point. Fmincon cannot continue.
Error in fmincon (line 861)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] =
barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, …
Error in Calibration (line 161)
[x, fval ] = fmincon(GGG, x0, A, b, Aeq, beq, lb, ub, nonlcon, opts); Hello,
Please can someone help me solve this issue. I keep getting the below error. Attached also is my matlab codes.
Thanks,
Celestine.
>> Calibration
Error using barrier
Objective function is undefined at initial point. Fmincon cannot continue.
Error in fmincon (line 861)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] =
barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, …
Error in Calibration (line 161)
[x, fval ] = fmincon(GGG, x0, A, b, Aeq, beq, lb, ub, nonlcon, opts); fmincon, optimization MATLAB Answers — New Questions
Nonorthogonal eigenvectors for general eigenvalue problem with eig() and eigs()
I am working with a finite element model and want to decompose my system using the eigenvectors of the system. The eigenvalue problem is of the form: K*V = M*V*D, where V is the eigenvector matrix and D is the eigenvalue matrix. Both M and K are block diagonal symmetric matrices. For the generalized eigenvalue problem it should be the case that V’*M*V = a matrix whose only nonzero terms are along the diagonal, but I am getting nonzero terms on either side of these. Using the code included below for something like N =5, I get (after rounding to nearest 3rd decimal to remove near zero terms)
abs( Orthgonal_Check_eig) = [ 78.8050 0 0 0 0
0 43.4540 0 0 0
0 0 0 34.9310 0
0 0 34.9310 0 0
0 0 0 0 29.6430]
Where I am taking the absolute value because this case has complex eigenvectors (though I believe I’ve seen it with real eigenvector matrices as well). If I rerun the code it does not always happen, but I am trying to understand why this can occur for both eig() and eigs() so that I can determine if it is the conditioning of the matrices or if it is inherent to the approximations inside of eig() and eigs(). Is there a better one of the two to use to avoid this issue?
N = 5;
M = zeros(N,N);
K = zeros(N,N);
for ii = 1:N
% Diagonal Terms
M(ii,ii) = rand*50;
K(ii,ii) = rand*500;
if ii ~=N
% Off Diagonal Terms
off_diagonal = rand*50;
M(ii,ii+1) = off_diagonal;
K(ii,ii+1) = off_diagonal*10;
M(ii+1,ii) = off_diagonal;
K(ii+1,ii) = off_diagonal*10;
end
end
M= round(M);
K= round(K);
[Veig,~] = eig(K,M);
[Veigs,~] = eigs(K,M,3);
Orthgonal_Check_eig = Veig’*M*Veig;
Orthgonal_Check_eigs =Veigs’*M*Veigs;I am working with a finite element model and want to decompose my system using the eigenvectors of the system. The eigenvalue problem is of the form: K*V = M*V*D, where V is the eigenvector matrix and D is the eigenvalue matrix. Both M and K are block diagonal symmetric matrices. For the generalized eigenvalue problem it should be the case that V’*M*V = a matrix whose only nonzero terms are along the diagonal, but I am getting nonzero terms on either side of these. Using the code included below for something like N =5, I get (after rounding to nearest 3rd decimal to remove near zero terms)
abs( Orthgonal_Check_eig) = [ 78.8050 0 0 0 0
0 43.4540 0 0 0
0 0 0 34.9310 0
0 0 34.9310 0 0
0 0 0 0 29.6430]
Where I am taking the absolute value because this case has complex eigenvectors (though I believe I’ve seen it with real eigenvector matrices as well). If I rerun the code it does not always happen, but I am trying to understand why this can occur for both eig() and eigs() so that I can determine if it is the conditioning of the matrices or if it is inherent to the approximations inside of eig() and eigs(). Is there a better one of the two to use to avoid this issue?
N = 5;
M = zeros(N,N);
K = zeros(N,N);
for ii = 1:N
% Diagonal Terms
M(ii,ii) = rand*50;
K(ii,ii) = rand*500;
if ii ~=N
% Off Diagonal Terms
off_diagonal = rand*50;
M(ii,ii+1) = off_diagonal;
K(ii,ii+1) = off_diagonal*10;
M(ii+1,ii) = off_diagonal;
K(ii+1,ii) = off_diagonal*10;
end
end
M= round(M);
K= round(K);
[Veig,~] = eig(K,M);
[Veigs,~] = eigs(K,M,3);
Orthgonal_Check_eig = Veig’*M*Veig;
Orthgonal_Check_eigs =Veigs’*M*Veigs; I am working with a finite element model and want to decompose my system using the eigenvectors of the system. The eigenvalue problem is of the form: K*V = M*V*D, where V is the eigenvector matrix and D is the eigenvalue matrix. Both M and K are block diagonal symmetric matrices. For the generalized eigenvalue problem it should be the case that V’*M*V = a matrix whose only nonzero terms are along the diagonal, but I am getting nonzero terms on either side of these. Using the code included below for something like N =5, I get (after rounding to nearest 3rd decimal to remove near zero terms)
abs( Orthgonal_Check_eig) = [ 78.8050 0 0 0 0
0 43.4540 0 0 0
0 0 0 34.9310 0
0 0 34.9310 0 0
0 0 0 0 29.6430]
Where I am taking the absolute value because this case has complex eigenvectors (though I believe I’ve seen it with real eigenvector matrices as well). If I rerun the code it does not always happen, but I am trying to understand why this can occur for both eig() and eigs() so that I can determine if it is the conditioning of the matrices or if it is inherent to the approximations inside of eig() and eigs(). Is there a better one of the two to use to avoid this issue?
N = 5;
M = zeros(N,N);
K = zeros(N,N);
for ii = 1:N
% Diagonal Terms
M(ii,ii) = rand*50;
K(ii,ii) = rand*500;
if ii ~=N
% Off Diagonal Terms
off_diagonal = rand*50;
M(ii,ii+1) = off_diagonal;
K(ii,ii+1) = off_diagonal*10;
M(ii+1,ii) = off_diagonal;
K(ii+1,ii) = off_diagonal*10;
end
end
M= round(M);
K= round(K);
[Veig,~] = eig(K,M);
[Veigs,~] = eigs(K,M,3);
Orthgonal_Check_eig = Veig’*M*Veig;
Orthgonal_Check_eigs =Veigs’*M*Veigs; eigenvalue problem, eig, eigs, orthogonality MATLAB Answers — New Questions
How to use previous version of matlab online?
I have a code written in matlab 2012a and I want to use matlab 2012a to run it online. However, my online version is 2020b. Can you suggest a way to use the previous version online ?I have a code written in matlab 2012a and I want to use matlab 2012a to run it online. However, my online version is 2020b. Can you suggest a way to use the previous version online ? I have a code written in matlab 2012a and I want to use matlab 2012a to run it online. However, my online version is 2020b. Can you suggest a way to use the previous version online ? matlab compiler MATLAB Answers — New Questions
Problem with Simscape Onramp task 9
Hello, I can´t answer the last task, task 9, of the section 8.1 of the simscape onramp course, I do exactly what I´m requested to do but I always get it wrong, I´ve been for several hours trying it but I simply don´t understand what I´m getting wrong. I´ve looked for the answer on Youtube but literally nobady has upload it, at least I haven´t found anybody, does anybody knows how to obtain the answer or can anybody tell me where can I find the way to solve it?, thank you!Hello, I can´t answer the last task, task 9, of the section 8.1 of the simscape onramp course, I do exactly what I´m requested to do but I always get it wrong, I´ve been for several hours trying it but I simply don´t understand what I´m getting wrong. I´ve looked for the answer on Youtube but literally nobady has upload it, at least I haven´t found anybody, does anybody knows how to obtain the answer or can anybody tell me where can I find the way to solve it?, thank you! Hello, I can´t answer the last task, task 9, of the section 8.1 of the simscape onramp course, I do exactly what I´m requested to do but I always get it wrong, I´ve been for several hours trying it but I simply don´t understand what I´m getting wrong. I´ve looked for the answer on Youtube but literally nobady has upload it, at least I haven´t found anybody, does anybody knows how to obtain the answer or can anybody tell me where can I find the way to solve it?, thank you! simscape MATLAB Answers — New Questions
Matlab 2024a giving the wrong Jacobian
if I run the below code in MATLAB 2024a, jacobian is zero. However, this is wrong.
If I use "clear" instead of "clear all", the answer is correct. However, in 2023b in both cases (clear or clear all) I get the correct answer?
is this a bug? or what is the point?
clear all
clc
syms a b c d m n s r x y k
dy1 = -x*( r*x.^2 – r*(a+b)*x + a*b +(c*y-r*d));
dy2 = s + m*x-n*y ;
dr = r-x;
F=[dy1;dy2;dr]
% equilibrium_points = solve(F == 0, [x, y, r]);
% equilibrium_points = …,
% [equilibrium_points.x, equilibrium_points.y, equilibrium_points.r];
J=jacobian(F,[x y r])if I run the below code in MATLAB 2024a, jacobian is zero. However, this is wrong.
If I use "clear" instead of "clear all", the answer is correct. However, in 2023b in both cases (clear or clear all) I get the correct answer?
is this a bug? or what is the point?
clear all
clc
syms a b c d m n s r x y k
dy1 = -x*( r*x.^2 – r*(a+b)*x + a*b +(c*y-r*d));
dy2 = s + m*x-n*y ;
dr = r-x;
F=[dy1;dy2;dr]
% equilibrium_points = solve(F == 0, [x, y, r]);
% equilibrium_points = …,
% [equilibrium_points.x, equilibrium_points.y, equilibrium_points.r];
J=jacobian(F,[x y r]) if I run the below code in MATLAB 2024a, jacobian is zero. However, this is wrong.
If I use "clear" instead of "clear all", the answer is correct. However, in 2023b in both cases (clear or clear all) I get the correct answer?
is this a bug? or what is the point?
clear all
clc
syms a b c d m n s r x y k
dy1 = -x*( r*x.^2 – r*(a+b)*x + a*b +(c*y-r*d));
dy2 = s + m*x-n*y ;
dr = r-x;
F=[dy1;dy2;dr]
% equilibrium_points = solve(F == 0, [x, y, r]);
% equilibrium_points = …,
% [equilibrium_points.x, equilibrium_points.y, equilibrium_points.r];
J=jacobian(F,[x y r]) jacobian, symbolic toolbox MATLAB Answers — New Questions