Category: Matlab
Category Archives: Matlab
Cassegrain Antenna Design Errors
I’m trying to run the attached code for a Cassegrain antenna, changing the frequency from 18 GHz to the GPS frequencies 1575.42 MHz and 1227.6 MHz. I changed the frequencies and the following errors came up: "Error in em.MeshGeometry/updateMesh, Error in em.MeshGeometry/getMesh, and Error in em.EmStructures/analyze". Can you help resolve the errors?
Rp=0.3175;
fp=0.2536;
Rsub=0.033;
fhyp=0.1416;
ant=cassegrain(‘Radius’,[Rp Rsub],’FocalLength’,[fp fhyp]);
show(ant);
Exciter=design(hornConical,17.7e9);
Exciter.FeedWidth=3.4e-3;
Exciter.Tilt=270;
Exciter.TiltAxis=[0 1 0];
show(Exciter);
ant=reflectorParabolic(‘Radius’,0.3175);
ant.Exciter=design(hornConical,17.7e9);
ant.Exciter.Tilt=90;
figure;
pattern(ant,18e9);
ant=cassegrain;
s=sparameters(ant,linspace(18e9,18.8e9,25));
figure;rfplot(s);
figure;
impedance(ant,linspace(18e9,18.8e9,25));
current(ant,18e9,’scale’,’log10′);
Exciter=design(horn,16.2e9);
Exciter.Tilt=270;
Exciter.TiltAxis=[0 1 0];
ant.Exciter=Exciter;
show(ant);
figure;
pattern(ant,18e9);I’m trying to run the attached code for a Cassegrain antenna, changing the frequency from 18 GHz to the GPS frequencies 1575.42 MHz and 1227.6 MHz. I changed the frequencies and the following errors came up: "Error in em.MeshGeometry/updateMesh, Error in em.MeshGeometry/getMesh, and Error in em.EmStructures/analyze". Can you help resolve the errors?
Rp=0.3175;
fp=0.2536;
Rsub=0.033;
fhyp=0.1416;
ant=cassegrain(‘Radius’,[Rp Rsub],’FocalLength’,[fp fhyp]);
show(ant);
Exciter=design(hornConical,17.7e9);
Exciter.FeedWidth=3.4e-3;
Exciter.Tilt=270;
Exciter.TiltAxis=[0 1 0];
show(Exciter);
ant=reflectorParabolic(‘Radius’,0.3175);
ant.Exciter=design(hornConical,17.7e9);
ant.Exciter.Tilt=90;
figure;
pattern(ant,18e9);
ant=cassegrain;
s=sparameters(ant,linspace(18e9,18.8e9,25));
figure;rfplot(s);
figure;
impedance(ant,linspace(18e9,18.8e9,25));
current(ant,18e9,’scale’,’log10′);
Exciter=design(horn,16.2e9);
Exciter.Tilt=270;
Exciter.TiltAxis=[0 1 0];
ant.Exciter=Exciter;
show(ant);
figure;
pattern(ant,18e9); I’m trying to run the attached code for a Cassegrain antenna, changing the frequency from 18 GHz to the GPS frequencies 1575.42 MHz and 1227.6 MHz. I changed the frequencies and the following errors came up: "Error in em.MeshGeometry/updateMesh, Error in em.MeshGeometry/getMesh, and Error in em.EmStructures/analyze". Can you help resolve the errors?
Rp=0.3175;
fp=0.2536;
Rsub=0.033;
fhyp=0.1416;
ant=cassegrain(‘Radius’,[Rp Rsub],’FocalLength’,[fp fhyp]);
show(ant);
Exciter=design(hornConical,17.7e9);
Exciter.FeedWidth=3.4e-3;
Exciter.Tilt=270;
Exciter.TiltAxis=[0 1 0];
show(Exciter);
ant=reflectorParabolic(‘Radius’,0.3175);
ant.Exciter=design(hornConical,17.7e9);
ant.Exciter.Tilt=90;
figure;
pattern(ant,18e9);
ant=cassegrain;
s=sparameters(ant,linspace(18e9,18.8e9,25));
figure;rfplot(s);
figure;
impedance(ant,linspace(18e9,18.8e9,25));
current(ant,18e9,’scale’,’log10′);
Exciter=design(horn,16.2e9);
Exciter.Tilt=270;
Exciter.TiltAxis=[0 1 0];
ant.Exciter=Exciter;
show(ant);
figure;
pattern(ant,18e9); cassegrain errors MATLAB Answers — New Questions
Ensuring Non-Negativity and Constraints Satisfaction in Regression with ReLU in MATLAB
Hello, MathWorks community,
I am currently working on a deep learning neural network for a regression problem using MATLAB R2023a. My dataset consists of three inputs and four outputs. The data has been split into training (80%) and testing (20%) subsets.
I am using the ReLU activation function in my network, and the training process is implemented via the TrainNetwork function. For predictions, I utilize the predict function to generate the four outputs based on the test data.
There are two points should be noted which are:
The actual (target) outputs for both training and testing datasets are always non-negative (i.e., ≥0).
A specific relationship must hold between the inputs and actual outputs for every instance in the dataset, given as:
(Input #3+Output #1+Output #4) − (Input #1+Input #2+Output #2+Output #3) = 0 (Think about it as balance constraint)
My questions are:
How can I ensure that the predicted outputs generated by the neural network are always non-negative?
How can I guarantee that the predicted outputs strictly satisfy the above relationship with the inputs ?
Any suggestions, insights, or example implementations would be greatly appreciated.
Thank you in advance for your help!
Best regards,Hello, MathWorks community,
I am currently working on a deep learning neural network for a regression problem using MATLAB R2023a. My dataset consists of three inputs and four outputs. The data has been split into training (80%) and testing (20%) subsets.
I am using the ReLU activation function in my network, and the training process is implemented via the TrainNetwork function. For predictions, I utilize the predict function to generate the four outputs based on the test data.
There are two points should be noted which are:
The actual (target) outputs for both training and testing datasets are always non-negative (i.e., ≥0).
A specific relationship must hold between the inputs and actual outputs for every instance in the dataset, given as:
(Input #3+Output #1+Output #4) − (Input #1+Input #2+Output #2+Output #3) = 0 (Think about it as balance constraint)
My questions are:
How can I ensure that the predicted outputs generated by the neural network are always non-negative?
How can I guarantee that the predicted outputs strictly satisfy the above relationship with the inputs ?
Any suggestions, insights, or example implementations would be greatly appreciated.
Thank you in advance for your help!
Best regards, Hello, MathWorks community,
I am currently working on a deep learning neural network for a regression problem using MATLAB R2023a. My dataset consists of three inputs and four outputs. The data has been split into training (80%) and testing (20%) subsets.
I am using the ReLU activation function in my network, and the training process is implemented via the TrainNetwork function. For predictions, I utilize the predict function to generate the four outputs based on the test data.
There are two points should be noted which are:
The actual (target) outputs for both training and testing datasets are always non-negative (i.e., ≥0).
A specific relationship must hold between the inputs and actual outputs for every instance in the dataset, given as:
(Input #3+Output #1+Output #4) − (Input #1+Input #2+Output #2+Output #3) = 0 (Think about it as balance constraint)
My questions are:
How can I ensure that the predicted outputs generated by the neural network are always non-negative?
How can I guarantee that the predicted outputs strictly satisfy the above relationship with the inputs ?
Any suggestions, insights, or example implementations would be greatly appreciated.
Thank you in advance for your help!
Best regards, deep learning, regression MATLAB Answers — New Questions
How to solve the following four integration in MATLAB
Hello all, I am trying to solve the following expression involving four integrations in MATLAB but note getting it correctly.
This is how I had tried to code:
integrand = @(y, h, z1, z2) (1 / gamma(m_0)) * …
gammainc( ((u_1 ./ …
(a_1 * zeta_1 * y .* g_1_abs_sq .* h .* P_h1_2 – …
u_1 * a_2 * zeta_1 * y .* g_1_abs_sq .* h .*P_h1_2 – …
u_1 * a_1 * zeta_1 * g_1_abs_sq .* h .* z1 – …
u_1 * a_1 * zeta_1 *P_h1_2 * z2 .* g_1_abs_sq .* h – …
u_1 * a_2 * zeta_1 * g_1_abs_sq .* h .* z1 – …
u_1 * a_2 * zeta_1 * P_h1_2 * z2 .* g_1_abs_sq .* h)) / …
(Omega_0 / m_0)),m_0) .* …
(1/gamma(m_0))*((m_0/Omega_0)^m_0)*y^(m_0-1)*exp(-m_0*y/Omega_0).* 1/(2*pi*A_1).*lambda_1*exp(-lambda_1*z1).*lambda_2*exp(-lambda_2*z2);
outer_integral = @(z2) arrayfun(@(z2_val) integral(@(y,h,z1) integrand(y,h,z1,z2_val ), 0, y_max(z2_val)), 0:1000);
% Perform the integration
op = integral(outer_integral, 0, 1000);
I am not getting why I am getting such errors:
Not enough input arguments.
Error in Analytical_2>@(z1,z2)(P_h1_2*(a_1-u_1*a_2))./(u_1*a_1*z1+u_1*a_1*P_h1_2*z2+u_1*a_2*z1+u_1*a_2*P_h1_2*z2) (line 96)
(u_1 * a_1 * z1 + u_1 * a_1 * P_h1_2 * z2 + …
Error in Analytical_2>@(z2_val)integral(@(y,h,z1)integrand(y,h,z1,z2_val),0,y_max(z2_val)) (line 132)
outer_integral = @(z2) arrayfun(@(z2_val) integral(@(y,h,z1) integrand(y,h,z1,z2_val ), 0, y_max(z2_val)), 0:1000);
Error in Analytical_2>@(z2)arrayfun(@(z2_val)integral(@(y,h,z1)integrand(y,h,z1,z2_val),0,y_max(z2_val)),0:1000) (line 132)
outer_integral = @(z2) arrayfun(@(z2_val) integral(@(y,h,z1) integrand(y,h,z1,z2_val ), 0, y_max(z2_val)), 0:1000);
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 87)
Q = integralCalc(fun,a,b,opstruct);
Error in Analytical_2 (line 136)
op = integral(outer_integral, 0, 1000);
Please note that I had intentionally not given other part of code which is used to produce the values of elements that are used in this integrand. Any help in this regard will be highly appreciated.Hello all, I am trying to solve the following expression involving four integrations in MATLAB but note getting it correctly.
This is how I had tried to code:
integrand = @(y, h, z1, z2) (1 / gamma(m_0)) * …
gammainc( ((u_1 ./ …
(a_1 * zeta_1 * y .* g_1_abs_sq .* h .* P_h1_2 – …
u_1 * a_2 * zeta_1 * y .* g_1_abs_sq .* h .*P_h1_2 – …
u_1 * a_1 * zeta_1 * g_1_abs_sq .* h .* z1 – …
u_1 * a_1 * zeta_1 *P_h1_2 * z2 .* g_1_abs_sq .* h – …
u_1 * a_2 * zeta_1 * g_1_abs_sq .* h .* z1 – …
u_1 * a_2 * zeta_1 * P_h1_2 * z2 .* g_1_abs_sq .* h)) / …
(Omega_0 / m_0)),m_0) .* …
(1/gamma(m_0))*((m_0/Omega_0)^m_0)*y^(m_0-1)*exp(-m_0*y/Omega_0).* 1/(2*pi*A_1).*lambda_1*exp(-lambda_1*z1).*lambda_2*exp(-lambda_2*z2);
outer_integral = @(z2) arrayfun(@(z2_val) integral(@(y,h,z1) integrand(y,h,z1,z2_val ), 0, y_max(z2_val)), 0:1000);
% Perform the integration
op = integral(outer_integral, 0, 1000);
I am not getting why I am getting such errors:
Not enough input arguments.
Error in Analytical_2>@(z1,z2)(P_h1_2*(a_1-u_1*a_2))./(u_1*a_1*z1+u_1*a_1*P_h1_2*z2+u_1*a_2*z1+u_1*a_2*P_h1_2*z2) (line 96)
(u_1 * a_1 * z1 + u_1 * a_1 * P_h1_2 * z2 + …
Error in Analytical_2>@(z2_val)integral(@(y,h,z1)integrand(y,h,z1,z2_val),0,y_max(z2_val)) (line 132)
outer_integral = @(z2) arrayfun(@(z2_val) integral(@(y,h,z1) integrand(y,h,z1,z2_val ), 0, y_max(z2_val)), 0:1000);
Error in Analytical_2>@(z2)arrayfun(@(z2_val)integral(@(y,h,z1)integrand(y,h,z1,z2_val),0,y_max(z2_val)),0:1000) (line 132)
outer_integral = @(z2) arrayfun(@(z2_val) integral(@(y,h,z1) integrand(y,h,z1,z2_val ), 0, y_max(z2_val)), 0:1000);
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 87)
Q = integralCalc(fun,a,b,opstruct);
Error in Analytical_2 (line 136)
op = integral(outer_integral, 0, 1000);
Please note that I had intentionally not given other part of code which is used to produce the values of elements that are used in this integrand. Any help in this regard will be highly appreciated. Hello all, I am trying to solve the following expression involving four integrations in MATLAB but note getting it correctly.
This is how I had tried to code:
integrand = @(y, h, z1, z2) (1 / gamma(m_0)) * …
gammainc( ((u_1 ./ …
(a_1 * zeta_1 * y .* g_1_abs_sq .* h .* P_h1_2 – …
u_1 * a_2 * zeta_1 * y .* g_1_abs_sq .* h .*P_h1_2 – …
u_1 * a_1 * zeta_1 * g_1_abs_sq .* h .* z1 – …
u_1 * a_1 * zeta_1 *P_h1_2 * z2 .* g_1_abs_sq .* h – …
u_1 * a_2 * zeta_1 * g_1_abs_sq .* h .* z1 – …
u_1 * a_2 * zeta_1 * P_h1_2 * z2 .* g_1_abs_sq .* h)) / …
(Omega_0 / m_0)),m_0) .* …
(1/gamma(m_0))*((m_0/Omega_0)^m_0)*y^(m_0-1)*exp(-m_0*y/Omega_0).* 1/(2*pi*A_1).*lambda_1*exp(-lambda_1*z1).*lambda_2*exp(-lambda_2*z2);
outer_integral = @(z2) arrayfun(@(z2_val) integral(@(y,h,z1) integrand(y,h,z1,z2_val ), 0, y_max(z2_val)), 0:1000);
% Perform the integration
op = integral(outer_integral, 0, 1000);
I am not getting why I am getting such errors:
Not enough input arguments.
Error in Analytical_2>@(z1,z2)(P_h1_2*(a_1-u_1*a_2))./(u_1*a_1*z1+u_1*a_1*P_h1_2*z2+u_1*a_2*z1+u_1*a_2*P_h1_2*z2) (line 96)
(u_1 * a_1 * z1 + u_1 * a_1 * P_h1_2 * z2 + …
Error in Analytical_2>@(z2_val)integral(@(y,h,z1)integrand(y,h,z1,z2_val),0,y_max(z2_val)) (line 132)
outer_integral = @(z2) arrayfun(@(z2_val) integral(@(y,h,z1) integrand(y,h,z1,z2_val ), 0, y_max(z2_val)), 0:1000);
Error in Analytical_2>@(z2)arrayfun(@(z2_val)integral(@(y,h,z1)integrand(y,h,z1,z2_val),0,y_max(z2_val)),0:1000) (line 132)
outer_integral = @(z2) arrayfun(@(z2_val) integral(@(y,h,z1) integrand(y,h,z1,z2_val ), 0, y_max(z2_val)), 0:1000);
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 87)
Q = integralCalc(fun,a,b,opstruct);
Error in Analytical_2 (line 136)
op = integral(outer_integral, 0, 1000);
Please note that I had intentionally not given other part of code which is used to produce the values of elements that are used in this integrand. Any help in this regard will be highly appreciated. integration, multiple integration, matlab, for loop, function MATLAB Answers — New Questions
how can i convert pixels into cms,the code that is available online is giving error
thia is the code that i m using.pixe
cmPerPixel = distanceInCm / distanceInPixels;
% Now to convert a distance.
lengthInCm = lengthInPixels * cmPerPixel
% And to convert an area in pixels to square cm:
areaInSquareCm = areaInPixels * cmPerPixel ^ 2thia is the code that i m using.pixe
cmPerPixel = distanceInCm / distanceInPixels;
% Now to convert a distance.
lengthInCm = lengthInPixels * cmPerPixel
% And to convert an area in pixels to square cm:
areaInSquareCm = areaInPixels * cmPerPixel ^ 2 thia is the code that i m using.pixe
cmPerPixel = distanceInCm / distanceInPixels;
% Now to convert a distance.
lengthInCm = lengthInPixels * cmPerPixel
% And to convert an area in pixels to square cm:
areaInSquareCm = areaInPixels * cmPerPixel ^ 2 pixels into cms, spatial calibration MATLAB Answers — New Questions
Integral command doesn’t work inside the for loop
Hello. I have this simple code trying to compare analytical solution of few functions with two numerical methods. I used for loop wih the integral command in it but i get many errors.
clear, clc, close all, format long
a = 0;
b = 2;
h1 = b – a;
h2 = (b – a)/2;
n = 1:5;
fprintf(‘tAnalyticaltTrapezoidtSimpsonnn’)
for i = 1:length(n)
f = @(x) x.^n;
I = integral(f,a,b);
Trap = 0.5*h1*(f(a) + f(b));
Simp = (h2/3)*(f(a) + 4*f(h2) + f(b));
fprintf(‘t%gtttt%gttt%gn’,I(i),Trap(i),Simp(i))
end
f = @(x) exp(x);
Trap = 0.5*h1*(f(a) + f(b));
Simp = (h2/3)*(f(a) + 4*f(h2) + f(b));
fprintf(‘t%gttt%gtt%gn’,I,Trap,Simp)Hello. I have this simple code trying to compare analytical solution of few functions with two numerical methods. I used for loop wih the integral command in it but i get many errors.
clear, clc, close all, format long
a = 0;
b = 2;
h1 = b – a;
h2 = (b – a)/2;
n = 1:5;
fprintf(‘tAnalyticaltTrapezoidtSimpsonnn’)
for i = 1:length(n)
f = @(x) x.^n;
I = integral(f,a,b);
Trap = 0.5*h1*(f(a) + f(b));
Simp = (h2/3)*(f(a) + 4*f(h2) + f(b));
fprintf(‘t%gtttt%gttt%gn’,I(i),Trap(i),Simp(i))
end
f = @(x) exp(x);
Trap = 0.5*h1*(f(a) + f(b));
Simp = (h2/3)*(f(a) + 4*f(h2) + f(b));
fprintf(‘t%gttt%gtt%gn’,I,Trap,Simp) Hello. I have this simple code trying to compare analytical solution of few functions with two numerical methods. I used for loop wih the integral command in it but i get many errors.
clear, clc, close all, format long
a = 0;
b = 2;
h1 = b – a;
h2 = (b – a)/2;
n = 1:5;
fprintf(‘tAnalyticaltTrapezoidtSimpsonnn’)
for i = 1:length(n)
f = @(x) x.^n;
I = integral(f,a,b);
Trap = 0.5*h1*(f(a) + f(b));
Simp = (h2/3)*(f(a) + 4*f(h2) + f(b));
fprintf(‘t%gtttt%gttt%gn’,I(i),Trap(i),Simp(i))
end
f = @(x) exp(x);
Trap = 0.5*h1*(f(a) + f(b));
Simp = (h2/3)*(f(a) + 4*f(h2) + f(b));
fprintf(‘t%gttt%gtt%gn’,I,Trap,Simp) numerical integration, trapezoid rule, simpson rule, integral command MATLAB Answers — New Questions
how to plot different range of files on one graph using hold on
i have 63 .mat files that contain cells of data. i am dividing the .mat files into three parts so that each file is plotted correspondingly on the same graph from another set. that is, file 1 in the first, second third set are plotted on the same graph using hold on and the same for file 2 and so on. Although, i have not included the plot command, i am still trying to see how the code looks like by dividing the files into two sets.
startIndex = 1;
endIndex = 3;
startIndex1 = 4;
endIndex1 = 6;
count1 = 0;
count2 = 0;
filelist = dir(‘C:UsersshedrDownloadstec data2017DOBUMttrttr1tt4*.mat’);
% first set of files
for fileidx = startIndex:endIndex
count1 = count1+1;
spectrum = load(filelist(fileidx).name);
C = spectrum.B
% second set of files
for fileidx1 = startIndex1:endIndex1
count2 = count2+1;
if count2 == count1
spectrum1 = load(filelist(fileidx1).name);
C1 = spectrum.B
end
end
% but the output is not favourable.i have 63 .mat files that contain cells of data. i am dividing the .mat files into three parts so that each file is plotted correspondingly on the same graph from another set. that is, file 1 in the first, second third set are plotted on the same graph using hold on and the same for file 2 and so on. Although, i have not included the plot command, i am still trying to see how the code looks like by dividing the files into two sets.
startIndex = 1;
endIndex = 3;
startIndex1 = 4;
endIndex1 = 6;
count1 = 0;
count2 = 0;
filelist = dir(‘C:UsersshedrDownloadstec data2017DOBUMttrttr1tt4*.mat’);
% first set of files
for fileidx = startIndex:endIndex
count1 = count1+1;
spectrum = load(filelist(fileidx).name);
C = spectrum.B
% second set of files
for fileidx1 = startIndex1:endIndex1
count2 = count2+1;
if count2 == count1
spectrum1 = load(filelist(fileidx1).name);
C1 = spectrum.B
end
end
% but the output is not favourable. i have 63 .mat files that contain cells of data. i am dividing the .mat files into three parts so that each file is plotted correspondingly on the same graph from another set. that is, file 1 in the first, second third set are plotted on the same graph using hold on and the same for file 2 and so on. Although, i have not included the plot command, i am still trying to see how the code looks like by dividing the files into two sets.
startIndex = 1;
endIndex = 3;
startIndex1 = 4;
endIndex1 = 6;
count1 = 0;
count2 = 0;
filelist = dir(‘C:UsersshedrDownloadstec data2017DOBUMttrttr1tt4*.mat’);
% first set of files
for fileidx = startIndex:endIndex
count1 = count1+1;
spectrum = load(filelist(fileidx).name);
C = spectrum.B
% second set of files
for fileidx1 = startIndex1:endIndex1
count2 = count2+1;
if count2 == count1
spectrum1 = load(filelist(fileidx1).name);
C1 = spectrum.B
end
end
% but the output is not favourable. file indexing, for loop hold on MATLAB Answers — New Questions
Is There A Way to Rename the “app” Component In appdesigner?
When you start appdesigner, the canvas window contains a single UIFigure. You can access the UIFigure via syntax like "app.UIFigure…" So the main component I think is the "app" component (or main ‘object’, I’m not sure I have the correct phrasing). I want to rename the "app" component to "A" such that I would then access the UIFigure via syntax like "A.UIFigure…".
Is it possible to rename "app" to "A" and how is it done.
Thanks in advance.When you start appdesigner, the canvas window contains a single UIFigure. You can access the UIFigure via syntax like "app.UIFigure…" So the main component I think is the "app" component (or main ‘object’, I’m not sure I have the correct phrasing). I want to rename the "app" component to "A" such that I would then access the UIFigure via syntax like "A.UIFigure…".
Is it possible to rename "app" to "A" and how is it done.
Thanks in advance. When you start appdesigner, the canvas window contains a single UIFigure. You can access the UIFigure via syntax like "app.UIFigure…" So the main component I think is the "app" component (or main ‘object’, I’m not sure I have the correct phrasing). I want to rename the "app" component to "A" such that I would then access the UIFigure via syntax like "A.UIFigure…".
Is it possible to rename "app" to "A" and how is it done.
Thanks in advance. appdesigner, app designer, components MATLAB Answers — New Questions
How to add TCL script to HDL Coder IP Core generation
I use HDL Coder IP Core flow and I need to add a TCL script that I have to open Vivado, add the new IP core to the existing project and implement with it.
I tried "add additional sources" option in HDL Coder to point to my TCL script there. The TCL script was never executed.
Of course I can run the script manually after IP core is generated, but I want to have a pushbutton solution, such that I only start IP Core generation and everything else would work automatically.
One possible way would be to do everything (including IP core generation) in a TCL script, but I don’t know how to make HDL coder to generate IP core in a TCL script.
Any suggestions?
Thank you, alexI use HDL Coder IP Core flow and I need to add a TCL script that I have to open Vivado, add the new IP core to the existing project and implement with it.
I tried "add additional sources" option in HDL Coder to point to my TCL script there. The TCL script was never executed.
Of course I can run the script manually after IP core is generated, but I want to have a pushbutton solution, such that I only start IP Core generation and everything else would work automatically.
One possible way would be to do everything (including IP core generation) in a TCL script, but I don’t know how to make HDL coder to generate IP core in a TCL script.
Any suggestions?
Thank you, alex I use HDL Coder IP Core flow and I need to add a TCL script that I have to open Vivado, add the new IP core to the existing project and implement with it.
I tried "add additional sources" option in HDL Coder to point to my TCL script there. The TCL script was never executed.
Of course I can run the script manually after IP core is generated, but I want to have a pushbutton solution, such that I only start IP Core generation and everything else would work automatically.
One possible way would be to do everything (including IP core generation) in a TCL script, but I don’t know how to make HDL coder to generate IP core in a TCL script.
Any suggestions?
Thank you, alex hdl coder, ip core, tcl script, tcl command MATLAB Answers — New Questions
filtfilt initial condition calculation … can someone explain it?
Can someone explain how to get from the article "Determining the initial states in forward-backward filtering, IEEE Transactions on Signal Processing" to the initial condition calculation used in the filtfilt function?
As far as I understand the article, the calculation works by finding inital values that minimize the difference between forward-backward and backward-forward application of the filter.
But how does this translate into the formula used in filtfilt and the extrapolation by reflection?
Could the extrapolation by reflection be replaced by chosing different initial conditions? The initial conditions of the filter reflect all the memory it has of previous samples.Can someone explain how to get from the article "Determining the initial states in forward-backward filtering, IEEE Transactions on Signal Processing" to the initial condition calculation used in the filtfilt function?
As far as I understand the article, the calculation works by finding inital values that minimize the difference between forward-backward and backward-forward application of the filter.
But how does this translate into the formula used in filtfilt and the extrapolation by reflection?
Could the extrapolation by reflection be replaced by chosing different initial conditions? The initial conditions of the filter reflect all the memory it has of previous samples. Can someone explain how to get from the article "Determining the initial states in forward-backward filtering, IEEE Transactions on Signal Processing" to the initial condition calculation used in the filtfilt function?
As far as I understand the article, the calculation works by finding inital values that minimize the difference between forward-backward and backward-forward application of the filter.
But how does this translate into the formula used in filtfilt and the extrapolation by reflection?
Could the extrapolation by reflection be replaced by chosing different initial conditions? The initial conditions of the filter reflect all the memory it has of previous samples. filtfilt MATLAB Answers — New Questions
can you please explain the logic of this code
function alphaKrow = mkpca(data,sigma,numev)
% ———————————————————————– %
global K
[n, d] = size(data);
% n : number of data points
% d : dimension of data points
sigma = 2.5;
% kernel matrix:
K = zeros(n,n);
% kernel parameter:
param = 0.5/(sigma*sigma);
% fprintf(‘computing kernel matrix Kn’);
for i=1:n
for j=i:n
K(i,j) = kernel(data(i,:),data(j,:),param);
K(j,i) = K(i,j);
end
end
% correct K for non-zero center of data in feature space:
Krow = sum(K,1)/n;
Ksum = sum(Krow)/n;
for i=1:n
for j=1:n
K(i,j) = K(i,j) – Krow(i) – Krow(j) + Ksum;
end
end
opts.disp = 0;
[alpha,lambda] = eigs(K);
% normalize alpha:
alpha = alpha * inv(sqrt(lambda));
% compute some helper vectors:
alphaKrow = Krow * alpha;
K = imresize(K,[256,256]);
% ———————————————————————– %
function k = kernel(x,y,param)
% ———————————————————————– %
diff = x-y;
k = exp(-(diff * diff’)*param);function alphaKrow = mkpca(data,sigma,numev)
% ———————————————————————– %
global K
[n, d] = size(data);
% n : number of data points
% d : dimension of data points
sigma = 2.5;
% kernel matrix:
K = zeros(n,n);
% kernel parameter:
param = 0.5/(sigma*sigma);
% fprintf(‘computing kernel matrix Kn’);
for i=1:n
for j=i:n
K(i,j) = kernel(data(i,:),data(j,:),param);
K(j,i) = K(i,j);
end
end
% correct K for non-zero center of data in feature space:
Krow = sum(K,1)/n;
Ksum = sum(Krow)/n;
for i=1:n
for j=1:n
K(i,j) = K(i,j) – Krow(i) – Krow(j) + Ksum;
end
end
opts.disp = 0;
[alpha,lambda] = eigs(K);
% normalize alpha:
alpha = alpha * inv(sqrt(lambda));
% compute some helper vectors:
alphaKrow = Krow * alpha;
K = imresize(K,[256,256]);
% ———————————————————————– %
function k = kernel(x,y,param)
% ———————————————————————– %
diff = x-y;
k = exp(-(diff * diff’)*param); function alphaKrow = mkpca(data,sigma,numev)
% ———————————————————————– %
global K
[n, d] = size(data);
% n : number of data points
% d : dimension of data points
sigma = 2.5;
% kernel matrix:
K = zeros(n,n);
% kernel parameter:
param = 0.5/(sigma*sigma);
% fprintf(‘computing kernel matrix Kn’);
for i=1:n
for j=i:n
K(i,j) = kernel(data(i,:),data(j,:),param);
K(j,i) = K(i,j);
end
end
% correct K for non-zero center of data in feature space:
Krow = sum(K,1)/n;
Ksum = sum(Krow)/n;
for i=1:n
for j=1:n
K(i,j) = K(i,j) – Krow(i) – Krow(j) + Ksum;
end
end
opts.disp = 0;
[alpha,lambda] = eigs(K);
% normalize alpha:
alpha = alpha * inv(sqrt(lambda));
% compute some helper vectors:
alphaKrow = Krow * alpha;
K = imresize(K,[256,256]);
% ———————————————————————– %
function k = kernel(x,y,param)
% ———————————————————————– %
diff = x-y;
k = exp(-(diff * diff’)*param); pca MATLAB Answers — New Questions
can anyone explain me dis gaussian low pass filter coding
[M N]=size(A);
R=10;
X=0:N-1;
Y=0:M-1;
[X Y]=meshgrid(X,Y);
Cx=0.5*N;
Cy=0.5*M;
Lo=exp(-((X-Cx).^2+(Y-Cy).^2)./(2*R).^2);
Hi=1-Lo;
J=A1.*Lo;
J1=ifftshift(J);
B1=ifft2(J1);
K=A1.*Hi;
K1=ifftshift(K);
B2=ifft2(K1);[M N]=size(A);
R=10;
X=0:N-1;
Y=0:M-1;
[X Y]=meshgrid(X,Y);
Cx=0.5*N;
Cy=0.5*M;
Lo=exp(-((X-Cx).^2+(Y-Cy).^2)./(2*R).^2);
Hi=1-Lo;
J=A1.*Lo;
J1=ifftshift(J);
B1=ifft2(J1);
K=A1.*Hi;
K1=ifftshift(K);
B2=ifft2(K1); [M N]=size(A);
R=10;
X=0:N-1;
Y=0:M-1;
[X Y]=meshgrid(X,Y);
Cx=0.5*N;
Cy=0.5*M;
Lo=exp(-((X-Cx).^2+(Y-Cy).^2)./(2*R).^2);
Hi=1-Lo;
J=A1.*Lo;
J1=ifftshift(J);
B1=ifft2(J1);
K=A1.*Hi;
K1=ifftshift(K);
B2=ifft2(K1); gaussian low pass filter, gaussian, low pass filter MATLAB Answers — New Questions
Simple circuit does not work
I am a novice in Simulink and electric circuits
The attached simple model does not initialize.
I cannot figure out why.
Any hint is welcome.
Best regardsI am a novice in Simulink and electric circuits
The attached simple model does not initialize.
I cannot figure out why.
Any hint is welcome.
Best regards I am a novice in Simulink and electric circuits
The attached simple model does not initialize.
I cannot figure out why.
Any hint is welcome.
Best regards electric circuits MATLAB Answers — New Questions
Please explain ‘statsfminbx’ function ?
The maximum likelihood estimation of factor loading. The problem in estimation of maximum likelihood is Undefined function ‘statsfminbx’ for input arguments of type ‘cell’. What is statsfminbx indicate here?The maximum likelihood estimation of factor loading. The problem in estimation of maximum likelihood is Undefined function ‘statsfminbx’ for input arguments of type ‘cell’. What is statsfminbx indicate here? The maximum likelihood estimation of factor loading. The problem in estimation of maximum likelihood is Undefined function ‘statsfminbx’ for input arguments of type ‘cell’. What is statsfminbx indicate here? factoran, statsfminbx, loglike., statistics, image processing MATLAB Answers — New Questions
Explain the below Kmeans code.
Extract from http://www.mathworks.in/matlabcentral/fileexchange/24616-kmeans-clustering/content/litekmeans/litekmeans.m, below
E = sparse(1:n,label,1,n,k,n); % transform label into indicator matrix
m = X*(E*spdiags(1./sum(E,1)’,0,k,k)); % compute m of each cluster
[~,label] = max(bsxfun(@minus,m’*X,dot(m,m,1)’/2),[],1); % assign samples to the
Can you please explain the above code?Extract from http://www.mathworks.in/matlabcentral/fileexchange/24616-kmeans-clustering/content/litekmeans/litekmeans.m, below
E = sparse(1:n,label,1,n,k,n); % transform label into indicator matrix
m = X*(E*spdiags(1./sum(E,1)’,0,k,k)); % compute m of each cluster
[~,label] = max(bsxfun(@minus,m’*X,dot(m,m,1)’/2),[],1); % assign samples to the
Can you please explain the above code? Extract from http://www.mathworks.in/matlabcentral/fileexchange/24616-kmeans-clustering/content/litekmeans/litekmeans.m, below
E = sparse(1:n,label,1,n,k,n); % transform label into indicator matrix
m = X*(E*spdiags(1./sum(E,1)’,0,k,k)); % compute m of each cluster
[~,label] = max(bsxfun(@minus,m’*X,dot(m,m,1)’/2),[],1); % assign samples to the
Can you please explain the above code? kmeans MATLAB Answers — New Questions
rdmseed name each legend with Yticklabel
In rdmseed function how can I put in each suplot’s legend the name of each Yticklabel?In rdmseed function how can I put in each suplot’s legend the name of each Yticklabel? In rdmseed function how can I put in each suplot’s legend the name of each Yticklabel? rdmseed, yticklabel MATLAB Answers — New Questions
Call to download server failed (HTTP error code: 403)
I am trying to download an application from github that utilises MATLAB runtime. the application is called SeabORD v1.2 which was created using MATLAB R2017a and that I must install the appropriate version of MATLAB Runtime, which is 9.2.
SeabORD/ at main · MarineScotlandScience/SeabORD · GitHub
The application will download MATLAB Runtime from the web, and when SeabORD is installed for the first time, MATLAB Runtime will be installed if required.
I am therefore getting the above error with the additional text:
"Call to download server failed (HTTP error code: 403). Try to rerun the installer. If that fails, please check your internet connection, firewall, proxy server or virus scanner settings".
It is not however my internet connection or firewall or proxy server or virus scanner settings thats causing the issue. I googled this issue and got directed to the matlab website Q and A hence why i am gathering tis a matlab issue and that my program is having issues downloading due to pulling MATLAB runtime from the web to try and install. Without MATLAB runtime i cannot download seaBORD which i need for my work.
Has an update or something caused a problem to arise with MATLAB? This is urgent and hence i need help fixing this.I am trying to download an application from github that utilises MATLAB runtime. the application is called SeabORD v1.2 which was created using MATLAB R2017a and that I must install the appropriate version of MATLAB Runtime, which is 9.2.
SeabORD/ at main · MarineScotlandScience/SeabORD · GitHub
The application will download MATLAB Runtime from the web, and when SeabORD is installed for the first time, MATLAB Runtime will be installed if required.
I am therefore getting the above error with the additional text:
"Call to download server failed (HTTP error code: 403). Try to rerun the installer. If that fails, please check your internet connection, firewall, proxy server or virus scanner settings".
It is not however my internet connection or firewall or proxy server or virus scanner settings thats causing the issue. I googled this issue and got directed to the matlab website Q and A hence why i am gathering tis a matlab issue and that my program is having issues downloading due to pulling MATLAB runtime from the web to try and install. Without MATLAB runtime i cannot download seaBORD which i need for my work.
Has an update or something caused a problem to arise with MATLAB? This is urgent and hence i need help fixing this. I am trying to download an application from github that utilises MATLAB runtime. the application is called SeabORD v1.2 which was created using MATLAB R2017a and that I must install the appropriate version of MATLAB Runtime, which is 9.2.
SeabORD/ at main · MarineScotlandScience/SeabORD · GitHub
The application will download MATLAB Runtime from the web, and when SeabORD is installed for the first time, MATLAB Runtime will be installed if required.
I am therefore getting the above error with the additional text:
"Call to download server failed (HTTP error code: 403). Try to rerun the installer. If that fails, please check your internet connection, firewall, proxy server or virus scanner settings".
It is not however my internet connection or firewall or proxy server or virus scanner settings thats causing the issue. I googled this issue and got directed to the matlab website Q and A hence why i am gathering tis a matlab issue and that my program is having issues downloading due to pulling MATLAB runtime from the web to try and install. Without MATLAB runtime i cannot download seaBORD which i need for my work.
Has an update or something caused a problem to arise with MATLAB? This is urgent and hence i need help fixing this. code 403, download server, seabord, http MATLAB Answers — New Questions
How do I download and install a support package on an offline machine?
How do I download Hardware Support Packages and Optional Features for installation on a computer that is offline or that is behind a Proxy/Firewall?How do I download Hardware Support Packages and Optional Features for installation on a computer that is offline or that is behind a Proxy/Firewall? How do I download Hardware Support Packages and Optional Features for installation on a computer that is offline or that is behind a Proxy/Firewall? MATLAB Answers — New Questions
How to get digital/analog input to speedgoat processor using IO334-325k
Hello,
I’m currently running a controller model on speedgoat IO334-325k FPGA, using hdl coder to define analog and digital interfaces with the outside world.
There are some other functions i would like to run on the speedgoat processor, not the FPGA, and the functions need to interface with my FPGA model. These functions also require inputs from the outside world, so i was wondering how i’d go about defining the interfaces? because hdl coder is only for defining FPGA interfaces?
Thank you in advance,
YeungHello,
I’m currently running a controller model on speedgoat IO334-325k FPGA, using hdl coder to define analog and digital interfaces with the outside world.
There are some other functions i would like to run on the speedgoat processor, not the FPGA, and the functions need to interface with my FPGA model. These functions also require inputs from the outside world, so i was wondering how i’d go about defining the interfaces? because hdl coder is only for defining FPGA interfaces?
Thank you in advance,
Yeung Hello,
I’m currently running a controller model on speedgoat IO334-325k FPGA, using hdl coder to define analog and digital interfaces with the outside world.
There are some other functions i would like to run on the speedgoat processor, not the FPGA, and the functions need to interface with my FPGA model. These functions also require inputs from the outside world, so i was wondering how i’d go about defining the interfaces? because hdl coder is only for defining FPGA interfaces?
Thank you in advance,
Yeung simulink coder, analog interface, digital interface, speedgoat, hdl coder MATLAB Answers — New Questions
Calculating the aortic flow downstream valve using Womersley and 3-element Windkessel model calculations from my FSI results – Why unusual sine waves at the end of flow curve?
So I have some aortic valve FSI results and I want to examine these results by modelling Womersley flow and using a 3-element Windkessel model in series to it (both downstream of the valve).
I am using the pressure (at the STJ) just downstream of my valve for the calculations (P_STJ, provided in the attached csv file).
I calculate the Womersley Impedance as according to literature (https://leifh.folk.ntnu.no/teaching/tkt4150/._main023.html) and it is connected to a 3 element windkessel model in series (as you can see in the code, with the values provided).
I perform Fourier transform on the pressure data and then divide it by total impedance to get the flow. However, as you can see when running the code (and attached image), that there is a discrepancy in values between the FSI values, that is approximately equal to the amplitude of that unusual sine wave at the end of the flow curve.
Am I doing something wrong? Should I attempt another method than fourier transform and series? Any recommendations?
Thank you in advance.So I have some aortic valve FSI results and I want to examine these results by modelling Womersley flow and using a 3-element Windkessel model in series to it (both downstream of the valve).
I am using the pressure (at the STJ) just downstream of my valve for the calculations (P_STJ, provided in the attached csv file).
I calculate the Womersley Impedance as according to literature (https://leifh.folk.ntnu.no/teaching/tkt4150/._main023.html) and it is connected to a 3 element windkessel model in series (as you can see in the code, with the values provided).
I perform Fourier transform on the pressure data and then divide it by total impedance to get the flow. However, as you can see when running the code (and attached image), that there is a discrepancy in values between the FSI values, that is approximately equal to the amplitude of that unusual sine wave at the end of the flow curve.
Am I doing something wrong? Should I attempt another method than fourier transform and series? Any recommendations?
Thank you in advance. So I have some aortic valve FSI results and I want to examine these results by modelling Womersley flow and using a 3-element Windkessel model in series to it (both downstream of the valve).
I am using the pressure (at the STJ) just downstream of my valve for the calculations (P_STJ, provided in the attached csv file).
I calculate the Womersley Impedance as according to literature (https://leifh.folk.ntnu.no/teaching/tkt4150/._main023.html) and it is connected to a 3 element windkessel model in series (as you can see in the code, with the values provided).
I perform Fourier transform on the pressure data and then divide it by total impedance to get the flow. However, as you can see when running the code (and attached image), that there is a discrepancy in values between the FSI values, that is approximately equal to the amplitude of that unusual sine wave at the end of the flow curve.
Am I doing something wrong? Should I attempt another method than fourier transform and series? Any recommendations?
Thank you in advance. aortic flow, womersley flow, windkessel model, mathematical modelling, lumped parameter modelling, frequency domain, fourier transform, fourier series, fluid mechanics MATLAB Answers — New Questions
CTRL + ALT not providing }
I am using CTRL + ALT to write } , however in 2024b this does not work anymore.
I am forced to use ALT GR.
I found no way to change that in the options. In other programs it works perfectly fine.
Is there a way for me to return this function as it was?I am using CTRL + ALT to write } , however in 2024b this does not work anymore.
I am forced to use ALT GR.
I found no way to change that in the options. In other programs it works perfectly fine.
Is there a way for me to return this function as it was? I am using CTRL + ALT to write } , however in 2024b this does not work anymore.
I am forced to use ALT GR.
I found no way to change that in the options. In other programs it works perfectly fine.
Is there a way for me to return this function as it was? keyboard, language, alt gr MATLAB Answers — New Questions