Category: Matlab
Category Archives: Matlab
how to calculate magnitude and phase angle of a complex number
for example -7+13i
how do i calculate and display the magnitude and phase angle of thisfor example -7+13i
how do i calculate and display the magnitude and phase angle of this for example -7+13i
how do i calculate and display the magnitude and phase angle of this complex, number, phase angle, magnitude MATLAB Answers — New Questions
reagrding implementation of meta learning algorithm selection
Hello,
could someone answer?
Can we apply meta learning algorithm selection(a model with can select a better image processing technique for a given image) in MATLAB.
Is it possible?Hello,
could someone answer?
Can we apply meta learning algorithm selection(a model with can select a better image processing technique for a given image) in MATLAB.
Is it possible? Hello,
could someone answer?
Can we apply meta learning algorithm selection(a model with can select a better image processing technique for a given image) in MATLAB.
Is it possible? meta learning, image processing MATLAB Answers — New Questions
Error in index returned by max() in the second dimension in obscure case
Attaced is AAA.mat which contains the matrix that generates the issue, as well as a code that reproduces the problem.
Following, copied from code, shows what the issue is, essentially, if I do max in the first dimension of permute(AAA,[2,1,3,4]) then everything works fine. But if I do max in the second dimension of AAA —which should give exact same answer— then the max-values are reported correctly but the max-indexes are incorrect.
%% The problematic example
load AAA.mat
[vv1,ii1]=max(AAA,[],2);
[vv2,ii2]=max(permute(AAA,[2,1,3,4]),[],1);
squeeze(vv1)-squeeze(vv2) % all zeros as expected
squeeze(ii1)-squeeze(ii2) % many non-zeros, which should not happen
% Note: vv1 is correct, but ii1 is incorrect
% E.g., vv1(1,1,1,2)=-2.6733
% Which is correct, and the same as vv2(1,1,1,2)=-2.6733
% By comparison, ii1(1,1,1,2)=3081
% But the correct answer is ii2(1,1,1,2)=1
% We can see this because AAA(1,3081,1,2)=-5.1175, which is not vv1
% By comparison, AAA(1,1,1,2)=-2.6733, which is exactly what we expect it to be
% Unless I am missing something, [vv1,ii1]=max(AAA,[],2); is returning the incorrect index for the max.
% Note: (:,:,1,1) gets the indexes correct, but the indexes corresponding to most other 3rd and 4th
% dimension points, like (:,:,1,5) and (:,:,5,1) are wrong.
I don’t know what about AAA causes this error to occur. The "max2derror.m" tries a bunch of things I thought of but they all work correctly.
Pretty sure I am getting this right 😐
I ran this in R2023b.Attaced is AAA.mat which contains the matrix that generates the issue, as well as a code that reproduces the problem.
Following, copied from code, shows what the issue is, essentially, if I do max in the first dimension of permute(AAA,[2,1,3,4]) then everything works fine. But if I do max in the second dimension of AAA —which should give exact same answer— then the max-values are reported correctly but the max-indexes are incorrect.
%% The problematic example
load AAA.mat
[vv1,ii1]=max(AAA,[],2);
[vv2,ii2]=max(permute(AAA,[2,1,3,4]),[],1);
squeeze(vv1)-squeeze(vv2) % all zeros as expected
squeeze(ii1)-squeeze(ii2) % many non-zeros, which should not happen
% Note: vv1 is correct, but ii1 is incorrect
% E.g., vv1(1,1,1,2)=-2.6733
% Which is correct, and the same as vv2(1,1,1,2)=-2.6733
% By comparison, ii1(1,1,1,2)=3081
% But the correct answer is ii2(1,1,1,2)=1
% We can see this because AAA(1,3081,1,2)=-5.1175, which is not vv1
% By comparison, AAA(1,1,1,2)=-2.6733, which is exactly what we expect it to be
% Unless I am missing something, [vv1,ii1]=max(AAA,[],2); is returning the incorrect index for the max.
% Note: (:,:,1,1) gets the indexes correct, but the indexes corresponding to most other 3rd and 4th
% dimension points, like (:,:,1,5) and (:,:,5,1) are wrong.
I don’t know what about AAA causes this error to occur. The "max2derror.m" tries a bunch of things I thought of but they all work correctly.
Pretty sure I am getting this right 😐
I ran this in R2023b. Attaced is AAA.mat which contains the matrix that generates the issue, as well as a code that reproduces the problem.
Following, copied from code, shows what the issue is, essentially, if I do max in the first dimension of permute(AAA,[2,1,3,4]) then everything works fine. But if I do max in the second dimension of AAA —which should give exact same answer— then the max-values are reported correctly but the max-indexes are incorrect.
%% The problematic example
load AAA.mat
[vv1,ii1]=max(AAA,[],2);
[vv2,ii2]=max(permute(AAA,[2,1,3,4]),[],1);
squeeze(vv1)-squeeze(vv2) % all zeros as expected
squeeze(ii1)-squeeze(ii2) % many non-zeros, which should not happen
% Note: vv1 is correct, but ii1 is incorrect
% E.g., vv1(1,1,1,2)=-2.6733
% Which is correct, and the same as vv2(1,1,1,2)=-2.6733
% By comparison, ii1(1,1,1,2)=3081
% But the correct answer is ii2(1,1,1,2)=1
% We can see this because AAA(1,3081,1,2)=-5.1175, which is not vv1
% By comparison, AAA(1,1,1,2)=-2.6733, which is exactly what we expect it to be
% Unless I am missing something, [vv1,ii1]=max(AAA,[],2); is returning the incorrect index for the max.
% Note: (:,:,1,1) gets the indexes correct, but the indexes corresponding to most other 3rd and 4th
% dimension points, like (:,:,1,5) and (:,:,5,1) are wrong.
I don’t know what about AAA causes this error to occur. The "max2derror.m" tries a bunch of things I thought of but they all work correctly.
Pretty sure I am getting this right 😐
I ran this in R2023b. max MATLAB Answers — New Questions
Print windows in matlab
Hi
I was making an application using GUIDE in matlab, my interface uses uicontrols, tables, and images, I’m trying how to print the whole information in the GUI application, i.e. the whole window but I cannot print it using the _print_ command. Is it possible to print or export as file the active window?Hi
I was making an application using GUIDE in matlab, my interface uses uicontrols, tables, and images, I’m trying how to print the whole information in the GUI application, i.e. the whole window but I cannot print it using the _print_ command. Is it possible to print or export as file the active window? Hi
I was making an application using GUIDE in matlab, my interface uses uicontrols, tables, and images, I’m trying how to print the whole information in the GUI application, i.e. the whole window but I cannot print it using the _print_ command. Is it possible to print or export as file the active window? guide, gui, print MATLAB Answers — New Questions
What does the sim(‘model’,[0 1]) do in the 2011a Matlab syntax
What does the array [0 1] do in the "sim(‘model’,[0 1]) command of an old simulink model, 2011-ish?What does the array [0 1] do in the "sim(‘model’,[0 1]) command of an old simulink model, 2011-ish? What does the array [0 1] do in the "sim(‘model’,[0 1]) command of an old simulink model, 2011-ish? array input to sim function MATLAB Answers — New Questions
3D radiation pattern / array factor of planar array in cylindrical coordinates
Dear MatLab Central Community,
I would like to plot the 3D array factor of a planar (2D) antenna array in cylindrical coordinates.
I have calculated the array factor in spherical coordinates AF(theta, phi) and I can easily plot it in spherical coordinates (using
[x,y,z] = sph2cart(THETA,PHI,R)
for coordinate conversion and then "surf(x,y,z)" or "mesh(x,y,z)" for 3D plotting), but I do not know how to do that in cylindrical coordinates.
In other words, I want the domain of the 2D function on the xy plane to be a grid in RHO, THETA and for each point plot the Z = AF value.
I tried to use other coordinate transformations but I did not manage to do that.
Thank you very much for any help.Dear MatLab Central Community,
I would like to plot the 3D array factor of a planar (2D) antenna array in cylindrical coordinates.
I have calculated the array factor in spherical coordinates AF(theta, phi) and I can easily plot it in spherical coordinates (using
[x,y,z] = sph2cart(THETA,PHI,R)
for coordinate conversion and then "surf(x,y,z)" or "mesh(x,y,z)" for 3D plotting), but I do not know how to do that in cylindrical coordinates.
In other words, I want the domain of the 2D function on the xy plane to be a grid in RHO, THETA and for each point plot the Z = AF value.
I tried to use other coordinate transformations but I did not manage to do that.
Thank you very much for any help. Dear MatLab Central Community,
I would like to plot the 3D array factor of a planar (2D) antenna array in cylindrical coordinates.
I have calculated the array factor in spherical coordinates AF(theta, phi) and I can easily plot it in spherical coordinates (using
[x,y,z] = sph2cart(THETA,PHI,R)
for coordinate conversion and then "surf(x,y,z)" or "mesh(x,y,z)" for 3D plotting), but I do not know how to do that in cylindrical coordinates.
In other words, I want the domain of the 2D function on the xy plane to be a grid in RHO, THETA and for each point plot the Z = AF value.
I tried to use other coordinate transformations but I did not manage to do that.
Thank you very much for any help. radiation pattern, 3d plots, array factor, cylindrical coordinates, cylindrical, antenna array, antenna pattern MATLAB Answers — New Questions
How can I plot the candle line into two figures with one time series object?
Hello everyone,
I am now doing a project about the stock .And now I need to plot a candle line,
I plotted it successesfully,However ,because I have about 300 days to plot into one figure,It is too small to regonize the details.I am know wondering if I can plot two figures with successive time,
ex:the time of first figure is from 01/01 ~05/03 ,and the other one is from 05/03~07/07
but I have no idea how to do it? any idea?
My candle code is simple :candle(DATA(:,2),DATA(:,3),DATA(:,4),DATA(:,1),’b’)Hello everyone,
I am now doing a project about the stock .And now I need to plot a candle line,
I plotted it successesfully,However ,because I have about 300 days to plot into one figure,It is too small to regonize the details.I am know wondering if I can plot two figures with successive time,
ex:the time of first figure is from 01/01 ~05/03 ,and the other one is from 05/03~07/07
but I have no idea how to do it? any idea?
My candle code is simple :candle(DATA(:,2),DATA(:,3),DATA(:,4),DATA(:,1),’b’) Hello everyone,
I am now doing a project about the stock .And now I need to plot a candle line,
I plotted it successesfully,However ,because I have about 300 days to plot into one figure,It is too small to regonize the details.I am know wondering if I can plot two figures with successive time,
ex:the time of first figure is from 01/01 ~05/03 ,and the other one is from 05/03~07/07
but I have no idea how to do it? any idea?
My candle code is simple :candle(DATA(:,2),DATA(:,3),DATA(:,4),DATA(:,1),’b’) plot, financial, graph MATLAB Answers — New Questions
Problem with the Transformer model in matlab simulink
When I run the simulation without the transformer block, everything works fine. However, when I add the transformer to the network, the waves become rectangular, and I receive the following error message:
"Warning: Could not evaluate MaskDisplay commands of block IEEE34bus_v2019b_Discrete_ZIPload/Three-Phase Transformer (Two Windings)1′: Unable to resolve the name ST.satx."
The model involves connecting the transformer to a three-phase load with a constant current of 150 kW and 75 kVAR. How can I resolve this issue?When I run the simulation without the transformer block, everything works fine. However, when I add the transformer to the network, the waves become rectangular, and I receive the following error message:
"Warning: Could not evaluate MaskDisplay commands of block IEEE34bus_v2019b_Discrete_ZIPload/Three-Phase Transformer (Two Windings)1′: Unable to resolve the name ST.satx."
The model involves connecting the transformer to a three-phase load with a constant current of 150 kW and 75 kVAR. How can I resolve this issue? When I run the simulation without the transformer block, everything works fine. However, when I add the transformer to the network, the waves become rectangular, and I receive the following error message:
"Warning: Could not evaluate MaskDisplay commands of block IEEE34bus_v2019b_Discrete_ZIPload/Three-Phase Transformer (Two Windings)1′: Unable to resolve the name ST.satx."
The model involves connecting the transformer to a three-phase load with a constant current of 150 kW and 75 kVAR. How can I resolve this issue? simulation, transformer, error, waveform, ieee34bu MATLAB Answers — New Questions
matlab reinforcement learning module RL Agent
I would like to ask how to use the agent module in simulink for the matlab version before 2020, because the version before 2020 does not have RL agent encapsulationI would like to ask how to use the agent module in simulink for the matlab version before 2020, because the version before 2020 does not have RL agent encapsulation I would like to ask how to use the agent module in simulink for the matlab version before 2020, because the version before 2020 does not have RL agent encapsulation reinforcement learning MATLAB Answers — New Questions
Need the graph for F,G,theta
conedisk2()
function conedisk2
% Parameter values
A1 = 1.10629;
A2 = 1.15;
A3 = 1.15;
A4 = 1.15;
A5 = 1.15;
A6 = 1.15;
M = 0.2;
Grt = 5;
Pr = 0.71;
R = 0.2;
Ec = 0.1;
Q = 0.1;
Rew = 12;
Red = 12;
n = -1;
g1 = 0;
g2 = 0;
g3 = 0;
g4 = 0;
inf = 0.06992681;
% Set solver options to increase the maximum number of mesh points
options = bvpset(‘RelTol’, 1e-5, ‘AbsTol’, 1e-7, ‘NMax’, 5000);
% Defining parameters
solinit = bvpinit(linspace(0, 1, 200), [0 g1 g2 Rew g3 0 1 g4]);
sol = bvp4c(@bvp2D, @bc2D, solinit);
x = sol.x;
y = sol.y;
% Plotting of the velocity
figure(1)
plot(x, y(1,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘F(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of G
figure(2)
plot(x, y(5,:), ‘linewidth’, 1)
hold on
xlabel(‘eta ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘G(eta) ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of theta
figure(3)
plot(x, y(7,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘theta(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Residual of the boundary conditions
function res = bc2D(y0, yinf)
res = [y0(1);yinf(1); y0(4); yinf(4);y0(5)-Rew; yinf(5)-Red;y0(7)-1; yinf(7)];
end
% System of First Order ODEs
function dydx = bvp2D(eta, y)
yy1 = (-(1+eta^2)*((10*A1*eta+A2*eta*y(1)-A2*y(4))*y(3))-3*(2*A1+7*A1*(eta^2)+A2*(2*eta^2+1)*y(1)-A2*eta*y(4))*y(2)-2*A2*y(5)*y(6)-3*(A1+A2*y(1))*y(4)+A3*M*y(2)-A4*Grt*y(8))/(A1*(1+eta^2)^2);
yy2 = eta*y(2);
yy3 = (-3*A1*eta*y(6)-A2*(eta*y(1)-y(4))*y(6)+A3*M*y(5))/(A1*(eta^2+1));
yy4 = ((A5+4/3*R)*((eta*((2*n)-1))*y(8)+n^2*y(7))-A3*Pr*M*Ec*(y(1)^2+y(5)^2)-Pr*Q*y(7)+A6*Pr*(y(4)*y(8)+n*y(1)*y(7)-eta*y(1)*y(8)))/(A5+4/3*R)*(1+eta^2);
dydx = [y(2); y(3); yy1; yy2; y(6); yy3; y(8); yy4];
end
end
The code is running but I am unable to get the graph what i have attached for radial velocity and azimuthal velocityconedisk2()
function conedisk2
% Parameter values
A1 = 1.10629;
A2 = 1.15;
A3 = 1.15;
A4 = 1.15;
A5 = 1.15;
A6 = 1.15;
M = 0.2;
Grt = 5;
Pr = 0.71;
R = 0.2;
Ec = 0.1;
Q = 0.1;
Rew = 12;
Red = 12;
n = -1;
g1 = 0;
g2 = 0;
g3 = 0;
g4 = 0;
inf = 0.06992681;
% Set solver options to increase the maximum number of mesh points
options = bvpset(‘RelTol’, 1e-5, ‘AbsTol’, 1e-7, ‘NMax’, 5000);
% Defining parameters
solinit = bvpinit(linspace(0, 1, 200), [0 g1 g2 Rew g3 0 1 g4]);
sol = bvp4c(@bvp2D, @bc2D, solinit);
x = sol.x;
y = sol.y;
% Plotting of the velocity
figure(1)
plot(x, y(1,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘F(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of G
figure(2)
plot(x, y(5,:), ‘linewidth’, 1)
hold on
xlabel(‘eta ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘G(eta) ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of theta
figure(3)
plot(x, y(7,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘theta(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Residual of the boundary conditions
function res = bc2D(y0, yinf)
res = [y0(1);yinf(1); y0(4); yinf(4);y0(5)-Rew; yinf(5)-Red;y0(7)-1; yinf(7)];
end
% System of First Order ODEs
function dydx = bvp2D(eta, y)
yy1 = (-(1+eta^2)*((10*A1*eta+A2*eta*y(1)-A2*y(4))*y(3))-3*(2*A1+7*A1*(eta^2)+A2*(2*eta^2+1)*y(1)-A2*eta*y(4))*y(2)-2*A2*y(5)*y(6)-3*(A1+A2*y(1))*y(4)+A3*M*y(2)-A4*Grt*y(8))/(A1*(1+eta^2)^2);
yy2 = eta*y(2);
yy3 = (-3*A1*eta*y(6)-A2*(eta*y(1)-y(4))*y(6)+A3*M*y(5))/(A1*(eta^2+1));
yy4 = ((A5+4/3*R)*((eta*((2*n)-1))*y(8)+n^2*y(7))-A3*Pr*M*Ec*(y(1)^2+y(5)^2)-Pr*Q*y(7)+A6*Pr*(y(4)*y(8)+n*y(1)*y(7)-eta*y(1)*y(8)))/(A5+4/3*R)*(1+eta^2);
dydx = [y(2); y(3); yy1; yy2; y(6); yy3; y(8); yy4];
end
end
The code is running but I am unable to get the graph what i have attached for radial velocity and azimuthal velocity conedisk2()
function conedisk2
% Parameter values
A1 = 1.10629;
A2 = 1.15;
A3 = 1.15;
A4 = 1.15;
A5 = 1.15;
A6 = 1.15;
M = 0.2;
Grt = 5;
Pr = 0.71;
R = 0.2;
Ec = 0.1;
Q = 0.1;
Rew = 12;
Red = 12;
n = -1;
g1 = 0;
g2 = 0;
g3 = 0;
g4 = 0;
inf = 0.06992681;
% Set solver options to increase the maximum number of mesh points
options = bvpset(‘RelTol’, 1e-5, ‘AbsTol’, 1e-7, ‘NMax’, 5000);
% Defining parameters
solinit = bvpinit(linspace(0, 1, 200), [0 g1 g2 Rew g3 0 1 g4]);
sol = bvp4c(@bvp2D, @bc2D, solinit);
x = sol.x;
y = sol.y;
% Plotting of the velocity
figure(1)
plot(x, y(1,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘F(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of G
figure(2)
plot(x, y(5,:), ‘linewidth’, 1)
hold on
xlabel(‘eta ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘G(eta) ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of theta
figure(3)
plot(x, y(7,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘theta(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Residual of the boundary conditions
function res = bc2D(y0, yinf)
res = [y0(1);yinf(1); y0(4); yinf(4);y0(5)-Rew; yinf(5)-Red;y0(7)-1; yinf(7)];
end
% System of First Order ODEs
function dydx = bvp2D(eta, y)
yy1 = (-(1+eta^2)*((10*A1*eta+A2*eta*y(1)-A2*y(4))*y(3))-3*(2*A1+7*A1*(eta^2)+A2*(2*eta^2+1)*y(1)-A2*eta*y(4))*y(2)-2*A2*y(5)*y(6)-3*(A1+A2*y(1))*y(4)+A3*M*y(2)-A4*Grt*y(8))/(A1*(1+eta^2)^2);
yy2 = eta*y(2);
yy3 = (-3*A1*eta*y(6)-A2*(eta*y(1)-y(4))*y(6)+A3*M*y(5))/(A1*(eta^2+1));
yy4 = ((A5+4/3*R)*((eta*((2*n)-1))*y(8)+n^2*y(7))-A3*Pr*M*Ec*(y(1)^2+y(5)^2)-Pr*Q*y(7)+A6*Pr*(y(4)*y(8)+n*y(1)*y(7)-eta*y(1)*y(8)))/(A5+4/3*R)*(1+eta^2);
dydx = [y(2); y(3); yy1; yy2; y(6); yy3; y(8); yy4];
end
end
The code is running but I am unable to get the graph what i have attached for radial velocity and azimuthal velocity conedisk MATLAB Answers — New Questions
运行循环或者整段代码的时候报错“未定义函数或变量”,但单独执行该段代码会将添加路径的数据赋值给变量,并且相同路径的上一个变量的赋值就正常
data_num=1;
for num1=1:data_num
switch num1
case 1
s4=’F:datasourc1.txt’;
sou4=load(strcat(s4));
pd1_1=sou4(1:2:end,:);
pd2_1=sou4(2:2:end,:);
case 2
s5=’F:datasource1.txt’;
sou5=load(strcat(s5));
pd1_2=sou5(1:2:end,:);
pd2_2=sou5(2:2:end,:);
otherwise
disp(‘input data error’)
end
NOTE: 只截取了程序的出错部分,无法在网站运行,还请各位论坛大神帮忙解答debug
报错:未定义函数或变量‘pd1_2’data_num=1;
for num1=1:data_num
switch num1
case 1
s4=’F:datasourc1.txt’;
sou4=load(strcat(s4));
pd1_1=sou4(1:2:end,:);
pd2_1=sou4(2:2:end,:);
case 2
s5=’F:datasource1.txt’;
sou5=load(strcat(s5));
pd1_2=sou5(1:2:end,:);
pd2_2=sou5(2:2:end,:);
otherwise
disp(‘input data error’)
end
NOTE: 只截取了程序的出错部分,无法在网站运行,还请各位论坛大神帮忙解答debug
报错:未定义函数或变量‘pd1_2′ data_num=1;
for num1=1:data_num
switch num1
case 1
s4=’F:datasourc1.txt’;
sou4=load(strcat(s4));
pd1_1=sou4(1:2:end,:);
pd2_1=sou4(2:2:end,:);
case 2
s5=’F:datasource1.txt’;
sou5=load(strcat(s5));
pd1_2=sou5(1:2:end,:);
pd2_2=sou5(2:2:end,:);
otherwise
disp(‘input data error’)
end
NOTE: 只截取了程序的出错部分,无法在网站运行,还请各位论坛大神帮忙解答debug
报错:未定义函数或变量‘pd1_2′ 数据调用,变量赋值 MATLAB Answers — New Questions
projcrs function is not working
Hello, I cannot use projcrs somehow, I need it to extract some json georef data and make a latitude/longitude map so I can extract specific pixels over my .tiff file. I am reading my json file and I was trying to do
utmZone = ‘32634’;
utmProjection = projcrs(utmZone);
[lat, lon] = projfwd(utmProjection, xCoords, yCoords);
But projcrs fails. I tried with many format and other numbers.
Is there something I may be missing?
>> p = projcrs(28992);
Error: File: validateLengthUnit.m Line: 1 Column: 1
Invalid text character. Check for unsupported symbol, invisible character, or pasting of non-ASCII characters.
Error in referenceEllipsoid/epsgEllipsoid (line 481)
self.pLengthUnit = validateLengthUnit(uom_name);
Error in referenceEllipsoid (line 288)
self = self.epsgEllipsoid(code);
Error in geocrs/setPropertiesFromCRSInput (line 212)
obj.Spheroid = referenceEllipsoid(ellipsoidcode);
Error in geocrs (line 71)
obj = setPropertiesFromCRSInput(obj, crs);
Error in projcrs/setPropertiesFromCRSInput (line 498)
obj.GeographicCRS = geocrs(gcrscode,"Authority",crsinfo.GCRSAuthority);
Error in projcrs (line 89)
obj = setPropertiesFromCRSInput(obj, crs);Hello, I cannot use projcrs somehow, I need it to extract some json georef data and make a latitude/longitude map so I can extract specific pixels over my .tiff file. I am reading my json file and I was trying to do
utmZone = ‘32634’;
utmProjection = projcrs(utmZone);
[lat, lon] = projfwd(utmProjection, xCoords, yCoords);
But projcrs fails. I tried with many format and other numbers.
Is there something I may be missing?
>> p = projcrs(28992);
Error: File: validateLengthUnit.m Line: 1 Column: 1
Invalid text character. Check for unsupported symbol, invisible character, or pasting of non-ASCII characters.
Error in referenceEllipsoid/epsgEllipsoid (line 481)
self.pLengthUnit = validateLengthUnit(uom_name);
Error in referenceEllipsoid (line 288)
self = self.epsgEllipsoid(code);
Error in geocrs/setPropertiesFromCRSInput (line 212)
obj.Spheroid = referenceEllipsoid(ellipsoidcode);
Error in geocrs (line 71)
obj = setPropertiesFromCRSInput(obj, crs);
Error in projcrs/setPropertiesFromCRSInput (line 498)
obj.GeographicCRS = geocrs(gcrscode,"Authority",crsinfo.GCRSAuthority);
Error in projcrs (line 89)
obj = setPropertiesFromCRSInput(obj, crs); Hello, I cannot use projcrs somehow, I need it to extract some json georef data and make a latitude/longitude map so I can extract specific pixels over my .tiff file. I am reading my json file and I was trying to do
utmZone = ‘32634’;
utmProjection = projcrs(utmZone);
[lat, lon] = projfwd(utmProjection, xCoords, yCoords);
But projcrs fails. I tried with many format and other numbers.
Is there something I may be missing?
>> p = projcrs(28992);
Error: File: validateLengthUnit.m Line: 1 Column: 1
Invalid text character. Check for unsupported symbol, invisible character, or pasting of non-ASCII characters.
Error in referenceEllipsoid/epsgEllipsoid (line 481)
self.pLengthUnit = validateLengthUnit(uom_name);
Error in referenceEllipsoid (line 288)
self = self.epsgEllipsoid(code);
Error in geocrs/setPropertiesFromCRSInput (line 212)
obj.Spheroid = referenceEllipsoid(ellipsoidcode);
Error in geocrs (line 71)
obj = setPropertiesFromCRSInput(obj, crs);
Error in projcrs/setPropertiesFromCRSInput (line 498)
obj.GeographicCRS = geocrs(gcrscode,"Authority",crsinfo.GCRSAuthority);
Error in projcrs (line 89)
obj = setPropertiesFromCRSInput(obj, crs); image processing MATLAB Answers — New Questions
MCR dll 7.16 32-bit 64-bit Windows 7
Hi.
I use R2011B on a 32-bit installation on Windows 7. Where can I find the files for the MCR dll that I can send to customers so they can run compiled scripts.
Are their different 32-bit and 64-bit versions?
I knew how to do this for R2007B on 32-bit but now I am stuck.
I can install 64-bit if it helps but just dont use it for other reasons.Hi.
I use R2011B on a 32-bit installation on Windows 7. Where can I find the files for the MCR dll that I can send to customers so they can run compiled scripts.
Are their different 32-bit and 64-bit versions?
I knew how to do this for R2007B on 32-bit but now I am stuck.
I can install 64-bit if it helps but just dont use it for other reasons. Hi.
I use R2011B on a 32-bit installation on Windows 7. Where can I find the files for the MCR dll that I can send to customers so they can run compiled scripts.
Are their different 32-bit and 64-bit versions?
I knew how to do this for R2007B on 32-bit but now I am stuck.
I can install 64-bit if it helps but just dont use it for other reasons. mcr MATLAB Answers — New Questions
App designer creates a new function inside another function where a parfor loop exists
As the title suggests, it is created in an existing function with a parfor loop when creating a new function in App Designer. Commenting out the parfor loop creates the new function as normal.As the title suggests, it is created in an existing function with a parfor loop when creating a new function in App Designer. Commenting out the parfor loop creates the new function as normal. As the title suggests, it is created in an existing function with a parfor loop when creating a new function in App Designer. Commenting out the parfor loop creates the new function as normal. app designer, parfor MATLAB Answers — New Questions
How to log the data in the workspace without modifying the content of the for loop?
I am currently using MATLAB 2022a.
I have a for loop (let’s call this for loop LOOP_A) doing some calculation and each calculation is depending on some values from the previous loop.
Without editting too much of the content of LOOP_A, I want to log those variables at the end of each loop.
I’m thinking about having another for loop (let’s call this one LOOP_B) that log the data in the workspace for each loop of LOOP_A till the entire execution of the LOOP_A is finished.
Here is what I would like to have:
% Repeat the following till all loops are finished:
% LOOP_A:
% Pause after one iteration
% Send data from workspace to LOOP_B
% Wait till LOOP_B send "good to go" signal if not finished
% LOOP_B:
% Receive data from LOOP_A
% Store the data
% Send "good to go" signal to LOOP_A
% LOOP_A:
% Continue running for one iteration
% Send data from workspace to LOOP_B
% Wait till LOOP_B send "good to go" signal if not finished
% …
Is there a way I can do that?I am currently using MATLAB 2022a.
I have a for loop (let’s call this for loop LOOP_A) doing some calculation and each calculation is depending on some values from the previous loop.
Without editting too much of the content of LOOP_A, I want to log those variables at the end of each loop.
I’m thinking about having another for loop (let’s call this one LOOP_B) that log the data in the workspace for each loop of LOOP_A till the entire execution of the LOOP_A is finished.
Here is what I would like to have:
% Repeat the following till all loops are finished:
% LOOP_A:
% Pause after one iteration
% Send data from workspace to LOOP_B
% Wait till LOOP_B send "good to go" signal if not finished
% LOOP_B:
% Receive data from LOOP_A
% Store the data
% Send "good to go" signal to LOOP_A
% LOOP_A:
% Continue running for one iteration
% Send data from workspace to LOOP_B
% Wait till LOOP_B send "good to go" signal if not finished
% …
Is there a way I can do that? I am currently using MATLAB 2022a.
I have a for loop (let’s call this for loop LOOP_A) doing some calculation and each calculation is depending on some values from the previous loop.
Without editting too much of the content of LOOP_A, I want to log those variables at the end of each loop.
I’m thinking about having another for loop (let’s call this one LOOP_B) that log the data in the workspace for each loop of LOOP_A till the entire execution of the LOOP_A is finished.
Here is what I would like to have:
% Repeat the following till all loops are finished:
% LOOP_A:
% Pause after one iteration
% Send data from workspace to LOOP_B
% Wait till LOOP_B send "good to go" signal if not finished
% LOOP_B:
% Receive data from LOOP_A
% Store the data
% Send "good to go" signal to LOOP_A
% LOOP_A:
% Continue running for one iteration
% Send data from workspace to LOOP_B
% Wait till LOOP_B send "good to go" signal if not finished
% …
Is there a way I can do that? matlab MATLAB Answers — New Questions
Why am I continuously prompted to activate when I try to launch MATLAB?
I am trying to activate and use MATLAB. Every time I start MATLAB, it prompts me to activate, even though I complete the process and it states activation is complete each time.
Why am I continuously prompted to activate when I try to launch MATLAB?I am trying to activate and use MATLAB. Every time I start MATLAB, it prompts me to activate, even though I complete the process and it states activation is complete each time.
Why am I continuously prompted to activate when I try to launch MATLAB? I am trying to activate and use MATLAB. Every time I start MATLAB, it prompts me to activate, even though I complete the process and it states activation is complete each time.
Why am I continuously prompted to activate when I try to launch MATLAB? matlab, license, installation, key, activation, loop, actloop, conact MATLAB Answers — New Questions
I need to write a code to find numbers divisible by 7 and multiples of 5 from 1500:2700. How do I preallocate line 4 for speed and is my code the most efficient way to solve
result = [];
for num = 1500:2700
if mod(num, 7) == 0 && mod(num, 5) == 0
result = [result, num];
end
end
disp(‘Numbers between 1500 and 2700 that are divisible by 7 and multiples of 5:’);
disp(result);result = [];
for num = 1500:2700
if mod(num, 7) == 0 && mod(num, 5) == 0
result = [result, num];
end
end
disp(‘Numbers between 1500 and 2700 that are divisible by 7 and multiples of 5:’);
disp(result); result = [];
for num = 1500:2700
if mod(num, 7) == 0 && mod(num, 5) == 0
result = [result, num];
end
end
disp(‘Numbers between 1500 and 2700 that are divisible by 7 and multiples of 5:’);
disp(result); hw MATLAB Answers — New Questions
How to check/map simulink data set is matching model’s inports programmatically?
I have some simulink dataset stored in a lot of mat files.
Is there a way to check those dataset is still matching the model’s inports?
I know I can probably use Root Inport Mapper to check it manually, but I would like to know how to do that programmatically.
ThanksI have some simulink dataset stored in a lot of mat files.
Is there a way to check those dataset is still matching the model’s inports?
I know I can probably use Root Inport Mapper to check it manually, but I would like to know how to do that programmatically.
Thanks I have some simulink dataset stored in a lot of mat files.
Is there a way to check those dataset is still matching the model’s inports?
I know I can probably use Root Inport Mapper to check it manually, but I would like to know how to do that programmatically.
Thanks root inport mapper, simulink MATLAB Answers — New Questions
List Arduinos and connect to multiple Simulink
Hi,
I have 2 questions. 1 is about the com port and 2 is about the setting up the simulink via code.
So I found out that 2024A version has the function to list the Arduino using arduinolist – List available Arduino hardware – MATLAB (mathworks.com) this function.
However, I am currently unable to get 2024a but has 2023b version so I am looking for some suggestions how to make this list automatically so I can utilize. My start idea is to list the comport using the serialportlist("available") to obtain the comport that are connected which was successful but couldn’t find a way to obtain the information from the comport to detect what which Arduino is connected to which comport.
Can anyone give me some suggestions?
The second question is about how to connect the Simulink to these each Arduino.
I am able to open the Simulink using the open_system But couldn’t get each Simulink to connect to each Arduino. Is there a way to code so that the specific Simulink can connect to a specific Arduino. Any ideas please?
Thanks!Hi,
I have 2 questions. 1 is about the com port and 2 is about the setting up the simulink via code.
So I found out that 2024A version has the function to list the Arduino using arduinolist – List available Arduino hardware – MATLAB (mathworks.com) this function.
However, I am currently unable to get 2024a but has 2023b version so I am looking for some suggestions how to make this list automatically so I can utilize. My start idea is to list the comport using the serialportlist("available") to obtain the comport that are connected which was successful but couldn’t find a way to obtain the information from the comport to detect what which Arduino is connected to which comport.
Can anyone give me some suggestions?
The second question is about how to connect the Simulink to these each Arduino.
I am able to open the Simulink using the open_system But couldn’t get each Simulink to connect to each Arduino. Is there a way to code so that the specific Simulink can connect to a specific Arduino. Any ideas please?
Thanks! Hi,
I have 2 questions. 1 is about the com port and 2 is about the setting up the simulink via code.
So I found out that 2024A version has the function to list the Arduino using arduinolist – List available Arduino hardware – MATLAB (mathworks.com) this function.
However, I am currently unable to get 2024a but has 2023b version so I am looking for some suggestions how to make this list automatically so I can utilize. My start idea is to list the comport using the serialportlist("available") to obtain the comport that are connected which was successful but couldn’t find a way to obtain the information from the comport to detect what which Arduino is connected to which comport.
Can anyone give me some suggestions?
The second question is about how to connect the Simulink to these each Arduino.
I am able to open the Simulink using the open_system But couldn’t get each Simulink to connect to each Arduino. Is there a way to code so that the specific Simulink can connect to a specific Arduino. Any ideas please?
Thanks! arduino, simulink, appdesigner MATLAB Answers — New Questions
Change grid cell size and interpolate values from old grid into new grid.
I currently have a bathymetric grid that is 1504 m x 1217 m, with a matrix size of 356×583. This means the grid cell size is roughly 2.58 x 3.42 and is therefore slightly rectangular.
I would like to create a grid that is a square 3 x 3 resolution to cover this domain, which will be a 405 x 501 matrix (1215m x 1503m), and interpolate the values of the old matrix into the new one. I have heard that I can use interp2, or griddata to do this, but I’m not 100% sure where to start. Could someone give me a couplke of pointers to get me on the way to achieving this?
Thanks!I currently have a bathymetric grid that is 1504 m x 1217 m, with a matrix size of 356×583. This means the grid cell size is roughly 2.58 x 3.42 and is therefore slightly rectangular.
I would like to create a grid that is a square 3 x 3 resolution to cover this domain, which will be a 405 x 501 matrix (1215m x 1503m), and interpolate the values of the old matrix into the new one. I have heard that I can use interp2, or griddata to do this, but I’m not 100% sure where to start. Could someone give me a couplke of pointers to get me on the way to achieving this?
Thanks! I currently have a bathymetric grid that is 1504 m x 1217 m, with a matrix size of 356×583. This means the grid cell size is roughly 2.58 x 3.42 and is therefore slightly rectangular.
I would like to create a grid that is a square 3 x 3 resolution to cover this domain, which will be a 405 x 501 matrix (1215m x 1503m), and interpolate the values of the old matrix into the new one. I have heard that I can use interp2, or griddata to do this, but I’m not 100% sure where to start. Could someone give me a couplke of pointers to get me on the way to achieving this?
Thanks! grid, matrix, domain, resolution MATLAB Answers — New Questions