Category: Matlab
Category Archives: Matlab
How to generating LDPC parity-check matrices with arbitrary sizes?
I want to use comm.LDPCEncoder/comm.LDPCDecoder and i know to use this encoder decoder in Matlab the H matrices should be Systematic (support Systematic codes only) otherwise i will receive this error.
"the last (N-K) columns of the parity-check matrix must be invertible in GF(2)."
I know two methods from MATLAB that will generate parity-check matrices:
H = dvbs2ldpc(r)
h = hammgen(m)
However, these methods are restricted to a certain ratio between rows and columns. I tried some other third-party scripts to generate the matrix, but some of them don’t seem to return a valid matrix, since "comm.LDPCDecoder" will fail with the same error.
I used some predefined H matrices of Mackay, but no way.
lent of my code-word is not fix it’s about 1000 to 3000 it depend to the situation of my simulation(for example code-word length is equal to 1536 or another case 2048), that’s why i should create a spars matrix then use it.
Now how to generate the LDPC parity-check matrices with arbitrary sizes[depend to length of my code-word]?
How to generating LDPC parity-check matrices with arbitrary sizes?I want to use comm.LDPCEncoder/comm.LDPCDecoder and i know to use this encoder decoder in Matlab the H matrices should be Systematic (support Systematic codes only) otherwise i will receive this error.
"the last (N-K) columns of the parity-check matrix must be invertible in GF(2)."
I know two methods from MATLAB that will generate parity-check matrices:
H = dvbs2ldpc(r)
h = hammgen(m)
However, these methods are restricted to a certain ratio between rows and columns. I tried some other third-party scripts to generate the matrix, but some of them don’t seem to return a valid matrix, since "comm.LDPCDecoder" will fail with the same error.
I used some predefined H matrices of Mackay, but no way.
lent of my code-word is not fix it’s about 1000 to 3000 it depend to the situation of my simulation(for example code-word length is equal to 1536 or another case 2048), that’s why i should create a spars matrix then use it.
Now how to generate the LDPC parity-check matrices with arbitrary sizes[depend to length of my code-word]?
How to generating LDPC parity-check matrices with arbitrary sizes? I want to use comm.LDPCEncoder/comm.LDPCDecoder and i know to use this encoder decoder in Matlab the H matrices should be Systematic (support Systematic codes only) otherwise i will receive this error.
"the last (N-K) columns of the parity-check matrix must be invertible in GF(2)."
I know two methods from MATLAB that will generate parity-check matrices:
H = dvbs2ldpc(r)
h = hammgen(m)
However, these methods are restricted to a certain ratio between rows and columns. I tried some other third-party scripts to generate the matrix, but some of them don’t seem to return a valid matrix, since "comm.LDPCDecoder" will fail with the same error.
I used some predefined H matrices of Mackay, but no way.
lent of my code-word is not fix it’s about 1000 to 3000 it depend to the situation of my simulation(for example code-word length is equal to 1536 or another case 2048), that’s why i should create a spars matrix then use it.
Now how to generate the LDPC parity-check matrices with arbitrary sizes[depend to length of my code-word]?
How to generating LDPC parity-check matrices with arbitrary sizes? ldpc, parity-check matrices, h matrices, comm.ldpcencoder, comm.ldpcdecoder MATLAB Answers — New Questions
How to view or change the driving cycle used in this model
Hi,
Can anyone help me find the table the import block is referring to to feed the reference velocities to the model. And also what would be the steps if i want to create such a input for a new model?
When I go to the "block parameters" for the inport block , then "Connect Input". Here I fond no signal pre selected variable.
I downloaded this model from https://in.mathworks.com/matlabcentral/fileexchange/63823-matlab-and-simulink-racing-lounge-vehicle-modeling
Thanks.Hi,
Can anyone help me find the table the import block is referring to to feed the reference velocities to the model. And also what would be the steps if i want to create such a input for a new model?
When I go to the "block parameters" for the inport block , then "Connect Input". Here I fond no signal pre selected variable.
I downloaded this model from https://in.mathworks.com/matlabcentral/fileexchange/63823-matlab-and-simulink-racing-lounge-vehicle-modeling
Thanks. Hi,
Can anyone help me find the table the import block is referring to to feed the reference velocities to the model. And also what would be the steps if i want to create such a input for a new model?
When I go to the "block parameters" for the inport block , then "Connect Input". Here I fond no signal pre selected variable.
I downloaded this model from https://in.mathworks.com/matlabcentral/fileexchange/63823-matlab-and-simulink-racing-lounge-vehicle-modeling
Thanks. simulink, vehicle model MATLAB Answers — New Questions
How can I get RAW capture with webcam function(without Image Acqusitio Toolbox)?
Hi,
I’m developing a depth camera and the camera using UVC(= webcam).
The output of the camera is not YUV or RGB but RAW16.
I tested that it is working with ‘webcam’ function in Matlab.
However, webcam function can only deliver the RGB image format with ‘snapshot’,(480x640x3(uint8)).
Can I get the RAW16(uint16) data using webcam/snapthot function?
I cannot find any options to do this.
BR,
Chanyong.Hi,
I’m developing a depth camera and the camera using UVC(= webcam).
The output of the camera is not YUV or RGB but RAW16.
I tested that it is working with ‘webcam’ function in Matlab.
However, webcam function can only deliver the RGB image format with ‘snapshot’,(480x640x3(uint8)).
Can I get the RAW16(uint16) data using webcam/snapthot function?
I cannot find any options to do this.
BR,
Chanyong. Hi,
I’m developing a depth camera and the camera using UVC(= webcam).
The output of the camera is not YUV or RGB but RAW16.
I tested that it is working with ‘webcam’ function in Matlab.
However, webcam function can only deliver the RGB image format with ‘snapshot’,(480x640x3(uint8)).
Can I get the RAW16(uint16) data using webcam/snapthot function?
I cannot find any options to do this.
BR,
Chanyong. webcam MATLAB Answers — New Questions
MATLAB Online command window not showing “>>” with no response in any input
Post Content Post Content command MATLAB Answers — New Questions
3/8 Simpson’s Rule
Hello guys. I have homework and I done most of parts. But I have a problem in code. Please help me. The questions like this
Write aMATLAB implementation that applies the Simpson’s 3/8 rule to find an approximation I
for I= integral(from 0 to 1) (e ^2x)*sin(6x)dx
when n=30,60,90 and 120
f=@(x)(exp^(2*x))*sin(6*x);
a=input(‘Enter lower limit a: ‘);
b=input(‘Enter upper limit b: ‘);
n=input(‘Enter the number of sub-intervals n: ‘);
h=(b-a)/n;
if rem(n,3)~=0
fprintf(‘n Enter valid n!!!’);
n=input(‘n Enter n as multiple of 3: ‘);
end
for k=1:1:n
x(k)=a+k*h;
y(k)=f(x(k));
end
so=0;sm3=0;
for k=2:1:n-1
if rem(k,3)==0
sm3=sm3+y(k);
else
so=so+y(k);
end
end
answer=(3*h/8)*(f(a)+f(b)+3*so+2*sm3);
fprintf(‘n The value of integration is %f’,answer);Hello guys. I have homework and I done most of parts. But I have a problem in code. Please help me. The questions like this
Write aMATLAB implementation that applies the Simpson’s 3/8 rule to find an approximation I
for I= integral(from 0 to 1) (e ^2x)*sin(6x)dx
when n=30,60,90 and 120
f=@(x)(exp^(2*x))*sin(6*x);
a=input(‘Enter lower limit a: ‘);
b=input(‘Enter upper limit b: ‘);
n=input(‘Enter the number of sub-intervals n: ‘);
h=(b-a)/n;
if rem(n,3)~=0
fprintf(‘n Enter valid n!!!’);
n=input(‘n Enter n as multiple of 3: ‘);
end
for k=1:1:n
x(k)=a+k*h;
y(k)=f(x(k));
end
so=0;sm3=0;
for k=2:1:n-1
if rem(k,3)==0
sm3=sm3+y(k);
else
so=so+y(k);
end
end
answer=(3*h/8)*(f(a)+f(b)+3*so+2*sm3);
fprintf(‘n The value of integration is %f’,answer); Hello guys. I have homework and I done most of parts. But I have a problem in code. Please help me. The questions like this
Write aMATLAB implementation that applies the Simpson’s 3/8 rule to find an approximation I
for I= integral(from 0 to 1) (e ^2x)*sin(6x)dx
when n=30,60,90 and 120
f=@(x)(exp^(2*x))*sin(6*x);
a=input(‘Enter lower limit a: ‘);
b=input(‘Enter upper limit b: ‘);
n=input(‘Enter the number of sub-intervals n: ‘);
h=(b-a)/n;
if rem(n,3)~=0
fprintf(‘n Enter valid n!!!’);
n=input(‘n Enter n as multiple of 3: ‘);
end
for k=1:1:n
x(k)=a+k*h;
y(k)=f(x(k));
end
so=0;sm3=0;
for k=2:1:n-1
if rem(k,3)==0
sm3=sm3+y(k);
else
so=so+y(k);
end
end
answer=(3*h/8)*(f(a)+f(b)+3*so+2*sm3);
fprintf(‘n The value of integration is %f’,answer); 3/8 simpson’s rule MATLAB Answers — New Questions
analyticity of a function
is there any function can be used to check if a function is analytic or not?is there any function can be used to check if a function is analytic or not? is there any function can be used to check if a function is analytic or not? MATLAB Answers — New Questions
• Given a three-phase power system with a medium-length transmission line, calculate the sending-end voltage and current by hand and by using Matlab code.
Trial>> %M-file to calculate the sending end voltage and current for a medium-length transmission line.
Trial>> %Initialize received voltage, impedance, and admittance
Trial>> vr = 12700 ;
Trial>> z = 0.1 + j*0.82;
Trial>> y = j*4.00e-3;
Trial>> %Calculate ABCD constants
Trial>> A=z*y/2 + 1;
Trial>> B=z;
Trial>> C=y * (z*y/4 + 1);
Trial>> D=z*y/2 + 1;
Trial>> %Calculate the sending end voltage
Trial>> ir = pol2cart(393.65,5.28);
Trial>> vs = A * vr + B * ir;
Trial>> [mag,phase] = cart2pol(vs);
Not enough input arguments.
Error in cart2pol (line 21)
th = atan2(y,x);Trial>> %M-file to calculate the sending end voltage and current for a medium-length transmission line.
Trial>> %Initialize received voltage, impedance, and admittance
Trial>> vr = 12700 ;
Trial>> z = 0.1 + j*0.82;
Trial>> y = j*4.00e-3;
Trial>> %Calculate ABCD constants
Trial>> A=z*y/2 + 1;
Trial>> B=z;
Trial>> C=y * (z*y/4 + 1);
Trial>> D=z*y/2 + 1;
Trial>> %Calculate the sending end voltage
Trial>> ir = pol2cart(393.65,5.28);
Trial>> vs = A * vr + B * ir;
Trial>> [mag,phase] = cart2pol(vs);
Not enough input arguments.
Error in cart2pol (line 21)
th = atan2(y,x); Trial>> %M-file to calculate the sending end voltage and current for a medium-length transmission line.
Trial>> %Initialize received voltage, impedance, and admittance
Trial>> vr = 12700 ;
Trial>> z = 0.1 + j*0.82;
Trial>> y = j*4.00e-3;
Trial>> %Calculate ABCD constants
Trial>> A=z*y/2 + 1;
Trial>> B=z;
Trial>> C=y * (z*y/4 + 1);
Trial>> D=z*y/2 + 1;
Trial>> %Calculate the sending end voltage
Trial>> ir = pol2cart(393.65,5.28);
Trial>> vs = A * vr + B * ir;
Trial>> [mag,phase] = cart2pol(vs);
Not enough input arguments.
Error in cart2pol (line 21)
th = atan2(y,x); how do i write the cart2 pol and pol2 cart formula for this? MATLAB Answers — New Questions
liscence manager error 8
i want to fix this error instantlyi want to fix this error instantly i want to fix this error instantly how to fix this MATLAB Answers — New Questions
optimization of nested loop with two variables
I have an optimization problem of minimizing a two-stage sampling variance subject to the expected variable cost as constraint, and here are my functions:
the objective function is:
function dblSum=dblSumFun(n_h,m_hi)
h=length(N_h);
dblSum=0;
for h=1:length(N_h)
iSum=0;
for i=1:N_h(h)
iTerm=(1/m_hi(i)-1/M_hi(i))*M_hi(i).^2*swh2(h);
iSum=iSum+iTerm;
end
hTerm = (1/n_h(h)-1/N_h(h))*N_h(h)^2*sbh2(h)+N_h(h)/n_h(h)*iSum;
dblSum=dblSum+hterm;
end
end
and the constraint is:
function [c,ceq]=nonlcon(n_h,m_hi)
h=length(N_h)
function dblSumc=dblSumFun(n_h,m_hi)
dblSumc=0;
for h=1:length(N_h)
iSum=0;
for i=1:N_h(h)
iTerm=(0.5*m_hi(i))
iSum=iSum+iTerm;
end
hTerm = 3.5-n_h(h)*0.7-n_h(h)/N_h(h)*iSum;
dblSumc=dblSumc+hterm;
end
end
ceq=dblSumc;% this will be satisfied if it eval to zero
c=[];
and the main coding for optimization is as follows
n_h0=zeros(length(N_h),1);%initial guess
m_hi0=zeros(26*n_h(h),1);
X0=[n_h0;m_hi0];
A=[];
B=[];
Aeq=[];
Beq=[];
options=optimoptions(‘fmincon’,’Algorithm’,’sqp’,’Display’,’iter-detailed’,…
‘MaxFunctionEvaluations’,100000,’MaxIterations’,2000,…
‘FunctionTolerance’,1e-10);
[n_h,m_hi,const]=fmincon(@(n_h,m_hi) obj_function(n_h,m_hi),X0,A,B,Aeq,Beq,LB,UB,@(n_h,m_hi) nonlcon(n_h,m_hi),options)
I wanted to obtain a vector of n_h for h=1,…,26; and a vector of m_hi for h=1,…,26 and i=1,…,n_h(h). Any help?I have an optimization problem of minimizing a two-stage sampling variance subject to the expected variable cost as constraint, and here are my functions:
the objective function is:
function dblSum=dblSumFun(n_h,m_hi)
h=length(N_h);
dblSum=0;
for h=1:length(N_h)
iSum=0;
for i=1:N_h(h)
iTerm=(1/m_hi(i)-1/M_hi(i))*M_hi(i).^2*swh2(h);
iSum=iSum+iTerm;
end
hTerm = (1/n_h(h)-1/N_h(h))*N_h(h)^2*sbh2(h)+N_h(h)/n_h(h)*iSum;
dblSum=dblSum+hterm;
end
end
and the constraint is:
function [c,ceq]=nonlcon(n_h,m_hi)
h=length(N_h)
function dblSumc=dblSumFun(n_h,m_hi)
dblSumc=0;
for h=1:length(N_h)
iSum=0;
for i=1:N_h(h)
iTerm=(0.5*m_hi(i))
iSum=iSum+iTerm;
end
hTerm = 3.5-n_h(h)*0.7-n_h(h)/N_h(h)*iSum;
dblSumc=dblSumc+hterm;
end
end
ceq=dblSumc;% this will be satisfied if it eval to zero
c=[];
and the main coding for optimization is as follows
n_h0=zeros(length(N_h),1);%initial guess
m_hi0=zeros(26*n_h(h),1);
X0=[n_h0;m_hi0];
A=[];
B=[];
Aeq=[];
Beq=[];
options=optimoptions(‘fmincon’,’Algorithm’,’sqp’,’Display’,’iter-detailed’,…
‘MaxFunctionEvaluations’,100000,’MaxIterations’,2000,…
‘FunctionTolerance’,1e-10);
[n_h,m_hi,const]=fmincon(@(n_h,m_hi) obj_function(n_h,m_hi),X0,A,B,Aeq,Beq,LB,UB,@(n_h,m_hi) nonlcon(n_h,m_hi),options)
I wanted to obtain a vector of n_h for h=1,…,26; and a vector of m_hi for h=1,…,26 and i=1,…,n_h(h). Any help? I have an optimization problem of minimizing a two-stage sampling variance subject to the expected variable cost as constraint, and here are my functions:
the objective function is:
function dblSum=dblSumFun(n_h,m_hi)
h=length(N_h);
dblSum=0;
for h=1:length(N_h)
iSum=0;
for i=1:N_h(h)
iTerm=(1/m_hi(i)-1/M_hi(i))*M_hi(i).^2*swh2(h);
iSum=iSum+iTerm;
end
hTerm = (1/n_h(h)-1/N_h(h))*N_h(h)^2*sbh2(h)+N_h(h)/n_h(h)*iSum;
dblSum=dblSum+hterm;
end
end
and the constraint is:
function [c,ceq]=nonlcon(n_h,m_hi)
h=length(N_h)
function dblSumc=dblSumFun(n_h,m_hi)
dblSumc=0;
for h=1:length(N_h)
iSum=0;
for i=1:N_h(h)
iTerm=(0.5*m_hi(i))
iSum=iSum+iTerm;
end
hTerm = 3.5-n_h(h)*0.7-n_h(h)/N_h(h)*iSum;
dblSumc=dblSumc+hterm;
end
end
ceq=dblSumc;% this will be satisfied if it eval to zero
c=[];
and the main coding for optimization is as follows
n_h0=zeros(length(N_h),1);%initial guess
m_hi0=zeros(26*n_h(h),1);
X0=[n_h0;m_hi0];
A=[];
B=[];
Aeq=[];
Beq=[];
options=optimoptions(‘fmincon’,’Algorithm’,’sqp’,’Display’,’iter-detailed’,…
‘MaxFunctionEvaluations’,100000,’MaxIterations’,2000,…
‘FunctionTolerance’,1e-10);
[n_h,m_hi,const]=fmincon(@(n_h,m_hi) obj_function(n_h,m_hi),X0,A,B,Aeq,Beq,LB,UB,@(n_h,m_hi) nonlcon(n_h,m_hi),options)
I wanted to obtain a vector of n_h for h=1,…,26; and a vector of m_hi for h=1,…,26 and i=1,…,n_h(h). Any help? nonlinear optimization nested sum vector MATLAB Answers — New Questions
How to Increase plotting speed
Hi everyone,I have a big trouble on plotting my results,it took a long time to complete the figure.Is there any method to increase plotting speed?
Thanks for your help!!!
clear
L=0.1;
a=L/2;
v=3e8;
f1=1.2e9;
f2=4.8e9;
f3=10e9;
w1=(2*pi*f1);
w2=(2*pi*f2);
w3=(2*pi*f3);
Z01=50;
Z02=50;
a0=(log(Z02/Z01))./(2.*L);
T=2*a;
k=1;
syms x y w
Am=-5;
%%% Eight section SFG
% Calculate gamma
s=L/8;
for n=1:1:k
V=Am(n);
P_am=((V*cos(n*pi*x/T)))*(exp(-2*1i*(w/v)*x));
P_am_int1(n)=int(P_am,x,[0 s]);
P_am_int2(n)=int(P_am,x,[s 2*s]);
P_am_int3(n)=int(P_am,x,[2*s 3*s]);
P_am_int4(n)=int(P_am,x,[3*s 4*s]);
P_am_int5(n)=int(P_am,x,[4*s 5*s]);
P_am_int6(n)=int(P_am,x,[5*s 6*s]);
P_am_int7(n)=int(P_am,x,[6*s 7*s]);
P_am_int8(n)=int(P_am,x,[7*s 8*s]);
end
Ga1=sum(P_am_int1);
Ga2=sum(P_am_int2);
Ga3=sum(P_am_int3);
Ga4=sum(P_am_int4);
Ga5=sum(P_am_int5);
Ga6=sum(P_am_int6);
Ga7=sum(P_am_int7);
Ga8=sum(P_am_int8);
Ga=[Ga1 Ga2 Ga3 Ga4 Ga5 Ga6 Ga7 Ga8];
Ta=1-((Ga(7:-1:1)).^2);
%%% SFG
section_num=8;
gamma_app8=Ga(section_num);
for m=1:1:section_num-1
gamma_app8=gamma_app8*((Ta(section_num-m)))/(1+abs((gamma_app8*Ga(section_num-m))));
gamma_app8=gamma_app8+Ga(section_num-m);
end
fplot(w,abs(gamma_app8),[0 w3],’-‘,’LineWidth’,3)Hi everyone,I have a big trouble on plotting my results,it took a long time to complete the figure.Is there any method to increase plotting speed?
Thanks for your help!!!
clear
L=0.1;
a=L/2;
v=3e8;
f1=1.2e9;
f2=4.8e9;
f3=10e9;
w1=(2*pi*f1);
w2=(2*pi*f2);
w3=(2*pi*f3);
Z01=50;
Z02=50;
a0=(log(Z02/Z01))./(2.*L);
T=2*a;
k=1;
syms x y w
Am=-5;
%%% Eight section SFG
% Calculate gamma
s=L/8;
for n=1:1:k
V=Am(n);
P_am=((V*cos(n*pi*x/T)))*(exp(-2*1i*(w/v)*x));
P_am_int1(n)=int(P_am,x,[0 s]);
P_am_int2(n)=int(P_am,x,[s 2*s]);
P_am_int3(n)=int(P_am,x,[2*s 3*s]);
P_am_int4(n)=int(P_am,x,[3*s 4*s]);
P_am_int5(n)=int(P_am,x,[4*s 5*s]);
P_am_int6(n)=int(P_am,x,[5*s 6*s]);
P_am_int7(n)=int(P_am,x,[6*s 7*s]);
P_am_int8(n)=int(P_am,x,[7*s 8*s]);
end
Ga1=sum(P_am_int1);
Ga2=sum(P_am_int2);
Ga3=sum(P_am_int3);
Ga4=sum(P_am_int4);
Ga5=sum(P_am_int5);
Ga6=sum(P_am_int6);
Ga7=sum(P_am_int7);
Ga8=sum(P_am_int8);
Ga=[Ga1 Ga2 Ga3 Ga4 Ga5 Ga6 Ga7 Ga8];
Ta=1-((Ga(7:-1:1)).^2);
%%% SFG
section_num=8;
gamma_app8=Ga(section_num);
for m=1:1:section_num-1
gamma_app8=gamma_app8*((Ta(section_num-m)))/(1+abs((gamma_app8*Ga(section_num-m))));
gamma_app8=gamma_app8+Ga(section_num-m);
end
fplot(w,abs(gamma_app8),[0 w3],’-‘,’LineWidth’,3) Hi everyone,I have a big trouble on plotting my results,it took a long time to complete the figure.Is there any method to increase plotting speed?
Thanks for your help!!!
clear
L=0.1;
a=L/2;
v=3e8;
f1=1.2e9;
f2=4.8e9;
f3=10e9;
w1=(2*pi*f1);
w2=(2*pi*f2);
w3=(2*pi*f3);
Z01=50;
Z02=50;
a0=(log(Z02/Z01))./(2.*L);
T=2*a;
k=1;
syms x y w
Am=-5;
%%% Eight section SFG
% Calculate gamma
s=L/8;
for n=1:1:k
V=Am(n);
P_am=((V*cos(n*pi*x/T)))*(exp(-2*1i*(w/v)*x));
P_am_int1(n)=int(P_am,x,[0 s]);
P_am_int2(n)=int(P_am,x,[s 2*s]);
P_am_int3(n)=int(P_am,x,[2*s 3*s]);
P_am_int4(n)=int(P_am,x,[3*s 4*s]);
P_am_int5(n)=int(P_am,x,[4*s 5*s]);
P_am_int6(n)=int(P_am,x,[5*s 6*s]);
P_am_int7(n)=int(P_am,x,[6*s 7*s]);
P_am_int8(n)=int(P_am,x,[7*s 8*s]);
end
Ga1=sum(P_am_int1);
Ga2=sum(P_am_int2);
Ga3=sum(P_am_int3);
Ga4=sum(P_am_int4);
Ga5=sum(P_am_int5);
Ga6=sum(P_am_int6);
Ga7=sum(P_am_int7);
Ga8=sum(P_am_int8);
Ga=[Ga1 Ga2 Ga3 Ga4 Ga5 Ga6 Ga7 Ga8];
Ta=1-((Ga(7:-1:1)).^2);
%%% SFG
section_num=8;
gamma_app8=Ga(section_num);
for m=1:1:section_num-1
gamma_app8=gamma_app8*((Ta(section_num-m)))/(1+abs((gamma_app8*Ga(section_num-m))));
gamma_app8=gamma_app8+Ga(section_num-m);
end
fplot(w,abs(gamma_app8),[0 w3],’-‘,’LineWidth’,3) plotting MATLAB Answers — New Questions
FFT is suddenly slow down for repeated operations.
Hello. I am conducting a simulation with a 3-dimensional matrix using Matlab. While performing FFT about one dimension of the 3-dimensional matrix using GPU for repeated operations, I noticed that the computation speed suddenly slows down. Below is a brief summary of the problematic code.
matlab
clear all; close all; clc;
k = 501;
A = zeros(k,k,k,’gpuArray’);
B = zeros(k,k,k,’gpuArray’);
for n = 1:k
tic
B(:,:,:) = fftshift(fft(ifftshift(A,1),[],1),1);
disp(num2str([n, toc]))
end
The result of running the code is as follows:
Result
….
236 7.52e-05
237 7.03e-05
238 7.11e-05
239 7.34e-05
240 7.29e-05
241 7.02e-05
242 0.0235287
243 0.0472623
244 0.0312132
245 0.0444045
246 0.0305904
247 0.0463637
248 0.0309244
….
As the result, from the 242nd iteration, the FFT operation significantly slows down.
I am curious about the cause of this issue.
The GPU used is 4090.
I would appreciate it if you could let me know what the problem might be.Hello. I am conducting a simulation with a 3-dimensional matrix using Matlab. While performing FFT about one dimension of the 3-dimensional matrix using GPU for repeated operations, I noticed that the computation speed suddenly slows down. Below is a brief summary of the problematic code.
matlab
clear all; close all; clc;
k = 501;
A = zeros(k,k,k,’gpuArray’);
B = zeros(k,k,k,’gpuArray’);
for n = 1:k
tic
B(:,:,:) = fftshift(fft(ifftshift(A,1),[],1),1);
disp(num2str([n, toc]))
end
The result of running the code is as follows:
Result
….
236 7.52e-05
237 7.03e-05
238 7.11e-05
239 7.34e-05
240 7.29e-05
241 7.02e-05
242 0.0235287
243 0.0472623
244 0.0312132
245 0.0444045
246 0.0305904
247 0.0463637
248 0.0309244
….
As the result, from the 242nd iteration, the FFT operation significantly slows down.
I am curious about the cause of this issue.
The GPU used is 4090.
I would appreciate it if you could let me know what the problem might be. Hello. I am conducting a simulation with a 3-dimensional matrix using Matlab. While performing FFT about one dimension of the 3-dimensional matrix using GPU for repeated operations, I noticed that the computation speed suddenly slows down. Below is a brief summary of the problematic code.
matlab
clear all; close all; clc;
k = 501;
A = zeros(k,k,k,’gpuArray’);
B = zeros(k,k,k,’gpuArray’);
for n = 1:k
tic
B(:,:,:) = fftshift(fft(ifftshift(A,1),[],1),1);
disp(num2str([n, toc]))
end
The result of running the code is as follows:
Result
….
236 7.52e-05
237 7.03e-05
238 7.11e-05
239 7.34e-05
240 7.29e-05
241 7.02e-05
242 0.0235287
243 0.0472623
244 0.0312132
245 0.0444045
246 0.0305904
247 0.0463637
248 0.0309244
….
As the result, from the 242nd iteration, the FFT operation significantly slows down.
I am curious about the cause of this issue.
The GPU used is 4090.
I would appreciate it if you could let me know what the problem might be. fft, for loop, gpu MATLAB Answers — New Questions
Why do I get the Xilinx Vivado error message “Specified part could not be found” during IP Core Generation with HDL Workflow Advisor or SoC Builder?
I am trying to generate an IP Core using HDL Coder. However, in step 3.2 of HDL Workflow Advisor, I see:
Failed Task "Vivado IP Packager" unsuccessful. See log for details. Generated logfile:
hdl_prjhdlsrcDUTnameworkflow_task_VivadoIPPackager.log
Error in hdlturnkey.ip.IPEmitterVivado/packageVivadoIP
Error in hdlturnkey.ip.IPDriver/generateIPCore
And the content in the "workflow_task_VivadoIPPackager.log" file is:
Task "Vivado IP Packager" unsuccessful. See log for details.
Generated logfile:
****** Vivado v2020.1 (64-bit)
**** SW Build 2902540 on Wed May 27 19:54:49 MDT 2020
**** IP Build 2902112 on Wed May 27 22:43:36 MDT 2020
** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
source vivado_ip_package.tcl -notrace
WARNING: [Device 21-436] No parts matched ‘xc7k325tffg900-2’
ERROR: [Coretcl 2-106] Specified part could not be found.
INFO: [Common 17-206] Exiting Vivado at Mon May 30 15:13:18 2022…
Elapsed time is 5.1019 seconds.
A log file with the same name containing the same error message may be created when using SoC Blockset and SoC Builder.I am trying to generate an IP Core using HDL Coder. However, in step 3.2 of HDL Workflow Advisor, I see:
Failed Task "Vivado IP Packager" unsuccessful. See log for details. Generated logfile:
hdl_prjhdlsrcDUTnameworkflow_task_VivadoIPPackager.log
Error in hdlturnkey.ip.IPEmitterVivado/packageVivadoIP
Error in hdlturnkey.ip.IPDriver/generateIPCore
And the content in the "workflow_task_VivadoIPPackager.log" file is:
Task "Vivado IP Packager" unsuccessful. See log for details.
Generated logfile:
****** Vivado v2020.1 (64-bit)
**** SW Build 2902540 on Wed May 27 19:54:49 MDT 2020
**** IP Build 2902112 on Wed May 27 22:43:36 MDT 2020
** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
source vivado_ip_package.tcl -notrace
WARNING: [Device 21-436] No parts matched ‘xc7k325tffg900-2’
ERROR: [Coretcl 2-106] Specified part could not be found.
INFO: [Common 17-206] Exiting Vivado at Mon May 30 15:13:18 2022…
Elapsed time is 5.1019 seconds.
A log file with the same name containing the same error message may be created when using SoC Blockset and SoC Builder. I am trying to generate an IP Core using HDL Coder. However, in step 3.2 of HDL Workflow Advisor, I see:
Failed Task "Vivado IP Packager" unsuccessful. See log for details. Generated logfile:
hdl_prjhdlsrcDUTnameworkflow_task_VivadoIPPackager.log
Error in hdlturnkey.ip.IPEmitterVivado/packageVivadoIP
Error in hdlturnkey.ip.IPDriver/generateIPCore
And the content in the "workflow_task_VivadoIPPackager.log" file is:
Task "Vivado IP Packager" unsuccessful. See log for details.
Generated logfile:
****** Vivado v2020.1 (64-bit)
**** SW Build 2902540 on Wed May 27 19:54:49 MDT 2020
**** IP Build 2902112 on Wed May 27 22:43:36 MDT 2020
** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
source vivado_ip_package.tcl -notrace
WARNING: [Device 21-436] No parts matched ‘xc7k325tffg900-2’
ERROR: [Coretcl 2-106] Specified part could not be found.
INFO: [Common 17-206] Exiting Vivado at Mon May 30 15:13:18 2022…
Elapsed time is 5.1019 seconds.
A log file with the same name containing the same error message may be created when using SoC Blockset and SoC Builder. MATLAB Answers — New Questions
Why do I get the error message “Run ‘impl_1’ has not been launched. Unable to open” when using HDL Coder, HDL Verifier or SoC Blockset?
When I try to run "HDL Workflow Advisor", "SoC Builder", or the "Verify Setup" test during the "HDL Verifier Support Package for Xilinx FPGA boards" hardware setup, the programming file generation fails for my Xilinx board. The following error is shown in MATLAB, or in the Vivado build log (vivado_build_prj.log):
ERROR: [Common 17-69] Command failed: Run ‘impl_1’ has not been launched. Unable to openWhen I try to run "HDL Workflow Advisor", "SoC Builder", or the "Verify Setup" test during the "HDL Verifier Support Package for Xilinx FPGA boards" hardware setup, the programming file generation fails for my Xilinx board. The following error is shown in MATLAB, or in the Vivado build log (vivado_build_prj.log):
ERROR: [Common 17-69] Command failed: Run ‘impl_1’ has not been launched. Unable to open When I try to run "HDL Workflow Advisor", "SoC Builder", or the "Verify Setup" test during the "HDL Verifier Support Package for Xilinx FPGA boards" hardware setup, the programming file generation fails for my Xilinx board. The following error is shown in MATLAB, or in the Vivado build log (vivado_build_prj.log):
ERROR: [Common 17-69] Command failed: Run ‘impl_1’ has not been launched. Unable to open vivado, webpack, programming, files, generation, failed , ml MATLAB Answers — New Questions
Do the “ADC/DAC Interface” reference designs support Vivado 2022.1 or later?
I am trying to follow the HDL Coder demo "DAC and ADC Loopback Data Capture" for my ZCU111 board using MATLAB R2023a (or later) and Xilinx Vivado 2022.1 (or later):
https://www.mathworks.com/help/hdlcoder/ug/hdl-dac-adc-loopback-data-capture.html
The demo uses the "Real ADC/DAC Interface" reference design, as specified in step 1.2 in the HDL Workflow Advisor.
However, I encounter errors similar to the following at step 4.1 in the HDL Workflow Advisor:
The following IPs are not found in the IP Catalog:
xilinx.com:ip:usp_rf_data_converter:2.4
ERROR: [BD 5-216] VLNV <xilinx.com:ip:usp_rf_data_converter:2.4> is not supported for the current part.
The latest supported version for this part is: <2.5>
Based on the following MATLAB Answers post:
https://www.mathworks.com/matlabcentral/answers/518421-which-versions-of-xilinx-vivado-are-supported-with-which-release-of-hdl-coder
MATLAB R2023a (or later) should support Vivado 2022.1 (or later). Why does the example not work?I am trying to follow the HDL Coder demo "DAC and ADC Loopback Data Capture" for my ZCU111 board using MATLAB R2023a (or later) and Xilinx Vivado 2022.1 (or later):
https://www.mathworks.com/help/hdlcoder/ug/hdl-dac-adc-loopback-data-capture.html
The demo uses the "Real ADC/DAC Interface" reference design, as specified in step 1.2 in the HDL Workflow Advisor.
However, I encounter errors similar to the following at step 4.1 in the HDL Workflow Advisor:
The following IPs are not found in the IP Catalog:
xilinx.com:ip:usp_rf_data_converter:2.4
ERROR: [BD 5-216] VLNV <xilinx.com:ip:usp_rf_data_converter:2.4> is not supported for the current part.
The latest supported version for this part is: <2.5>
Based on the following MATLAB Answers post:
https://www.mathworks.com/matlabcentral/answers/518421-which-versions-of-xilinx-vivado-are-supported-with-which-release-of-hdl-coder
MATLAB R2023a (or later) should support Vivado 2022.1 (or later). Why does the example not work? I am trying to follow the HDL Coder demo "DAC and ADC Loopback Data Capture" for my ZCU111 board using MATLAB R2023a (or later) and Xilinx Vivado 2022.1 (or later):
https://www.mathworks.com/help/hdlcoder/ug/hdl-dac-adc-loopback-data-capture.html
The demo uses the "Real ADC/DAC Interface" reference design, as specified in step 1.2 in the HDL Workflow Advisor.
However, I encounter errors similar to the following at step 4.1 in the HDL Workflow Advisor:
The following IPs are not found in the IP Catalog:
xilinx.com:ip:usp_rf_data_converter:2.4
ERROR: [BD 5-216] VLNV <xilinx.com:ip:usp_rf_data_converter:2.4> is not supported for the current part.
The latest supported version for this part is: <2.5>
Based on the following MATLAB Answers post:
https://www.mathworks.com/matlabcentral/answers/518421-which-versions-of-xilinx-vivado-are-supported-with-which-release-of-hdl-coder
MATLAB R2023a (or later) should support Vivado 2022.1 (or later). Why does the example not work? vivado, dac, adc, ip, core MATLAB Answers — New Questions
How do I create a (10,10) matrix containing numbers from 1 to 100?
How do I create a (10,10) matrix containing numbers from 1 to 100?
I just want the numbers to go 1 to 10 on the top row, then 11-20 on the 2nd row etc.How do I create a (10,10) matrix containing numbers from 1 to 100?
I just want the numbers to go 1 to 10 on the top row, then 11-20 on the 2nd row etc. How do I create a (10,10) matrix containing numbers from 1 to 100?
I just want the numbers to go 1 to 10 on the top row, then 11-20 on the 2nd row etc. matlab, matrix MATLAB Answers — New Questions
how to add grid to imagesc?
clear all
clc
a=rand(20,50)
x=linspace(-1,1,20)
y=linspace(-1,1,50)
imagesc(x,x,a)
I would like to add grid only at the border of every pixel in a way wen I zoom in only the initial grid appear
can someone help me with this.
thank you in advanceclear all
clc
a=rand(20,50)
x=linspace(-1,1,20)
y=linspace(-1,1,50)
imagesc(x,x,a)
I would like to add grid only at the border of every pixel in a way wen I zoom in only the initial grid appear
can someone help me with this.
thank you in advance clear all
clc
a=rand(20,50)
x=linspace(-1,1,20)
y=linspace(-1,1,50)
imagesc(x,x,a)
I would like to add grid only at the border of every pixel in a way wen I zoom in only the initial grid appear
can someone help me with this.
thank you in advance grid, image, plotting MATLAB Answers — New Questions
How to create simply light control in room using SIMULINK
Hello,
My question is how to create simple light control in room, which elements should I used?
Room should have input that someone is there (only if someone is there lights are on). There is also input with luminance and what luminance is atm.
Have someone any ideas or see in net similar solutions?
Best
PiotrHello,
My question is how to create simple light control in room, which elements should I used?
Room should have input that someone is there (only if someone is there lights are on). There is also input with luminance and what luminance is atm.
Have someone any ideas or see in net similar solutions?
Best
Piotr Hello,
My question is how to create simple light control in room, which elements should I used?
Room should have input that someone is there (only if someone is there lights are on). There is also input with luminance and what luminance is atm.
Have someone any ideas or see in net similar solutions?
Best
Piotr light control, simulink MATLAB Answers — New Questions
Sorting table row variables with number and letters
Hello,
I am trying to sort a table with values which looks something like this as an example below, my actual data has hundreds of rows of data.
And I want to make it look like this:
A = struct2table(data); %Data imported as struct and converted to table (50 x 6)
B = A(2,2:end); %Deletion of extra rows and keeping columns with variable names (1 x 5)
arrayB = table2array(B);
TableB = array2table(arrayB.’); % Transposing so variablenames are in rows (5 x 1)
TableB.Properties.RowNames = B.Properties.VariableNames; %Assigning Variable names to rows
TableC = TableB(:,sort(B.Properties.VariableNames));
After running the code I get the error:
Unrecognized variable name ‘abc_0_xyz’.
I’m stuck at this error since the variable is clearly in the table already so something is probably not right.
I’m thinking I need to remove either "_xyz" or "abc_" for the sort to work or use delimiter both of which I don’t know how or what function to use in my case. It’s my first post so apologies in advance if I missed anything. Any help is greatly appreciated
Thanks,Hello,
I am trying to sort a table with values which looks something like this as an example below, my actual data has hundreds of rows of data.
And I want to make it look like this:
A = struct2table(data); %Data imported as struct and converted to table (50 x 6)
B = A(2,2:end); %Deletion of extra rows and keeping columns with variable names (1 x 5)
arrayB = table2array(B);
TableB = array2table(arrayB.’); % Transposing so variablenames are in rows (5 x 1)
TableB.Properties.RowNames = B.Properties.VariableNames; %Assigning Variable names to rows
TableC = TableB(:,sort(B.Properties.VariableNames));
After running the code I get the error:
Unrecognized variable name ‘abc_0_xyz’.
I’m stuck at this error since the variable is clearly in the table already so something is probably not right.
I’m thinking I need to remove either "_xyz" or "abc_" for the sort to work or use delimiter both of which I don’t know how or what function to use in my case. It’s my first post so apologies in advance if I missed anything. Any help is greatly appreciated
Thanks, Hello,
I am trying to sort a table with values which looks something like this as an example below, my actual data has hundreds of rows of data.
And I want to make it look like this:
A = struct2table(data); %Data imported as struct and converted to table (50 x 6)
B = A(2,2:end); %Deletion of extra rows and keeping columns with variable names (1 x 5)
arrayB = table2array(B);
TableB = array2table(arrayB.’); % Transposing so variablenames are in rows (5 x 1)
TableB.Properties.RowNames = B.Properties.VariableNames; %Assigning Variable names to rows
TableC = TableB(:,sort(B.Properties.VariableNames));
After running the code I get the error:
Unrecognized variable name ‘abc_0_xyz’.
I’m stuck at this error since the variable is clearly in the table already so something is probably not right.
I’m thinking I need to remove either "_xyz" or "abc_" for the sort to work or use delimiter both of which I don’t know how or what function to use in my case. It’s my first post so apologies in advance if I missed anything. Any help is greatly appreciated
Thanks, table data sort MATLAB Answers — New Questions
How to bring in a single channel EEG signal from MATLAB workspace into Simulink?
I’ve been trying to bring an EEG signal into simulink that is made up of a single column, but it says I cannot use neither signal from workspace nor From work space block due to it not having a second channel (time related). Is there any other way to import the signal? I’ve tried inputting it as {t,data] but it still doesn’t work. My time was as follows:
t=0:1/256:40 %256 is the fs, and 40 is the signal duration in seconds
The data is a single channel eeg data, it is a column with 10240 values (256Hz * 40secs).I’ve been trying to bring an EEG signal into simulink that is made up of a single column, but it says I cannot use neither signal from workspace nor From work space block due to it not having a second channel (time related). Is there any other way to import the signal? I’ve tried inputting it as {t,data] but it still doesn’t work. My time was as follows:
t=0:1/256:40 %256 is the fs, and 40 is the signal duration in seconds
The data is a single channel eeg data, it is a column with 10240 values (256Hz * 40secs). I’ve been trying to bring an EEG signal into simulink that is made up of a single column, but it says I cannot use neither signal from workspace nor From work space block due to it not having a second channel (time related). Is there any other way to import the signal? I’ve tried inputting it as {t,data] but it still doesn’t work. My time was as follows:
t=0:1/256:40 %256 is the fs, and 40 is the signal duration in seconds
The data is a single channel eeg data, it is a column with 10240 values (256Hz * 40secs). simulink, simulink block, eeg, signal processing MATLAB Answers — New Questions
How can I download matlab R2016a?
As aboveAs above As above r2016a MATLAB Answers — New Questions