Tag Archives: matlab
How to connect broken lines, but no enlarge line width?
I need to fill rectangle(run fill holes), but the broken lines in rectangle stop me to do this. due to the high density rectangles in figure, so I want to connect broken lines, but no enlarge line width. Could you help me?
I have tryed to do dilate/erode/open/close mask operations, but they all can’t meet my request.I need to fill rectangle(run fill holes), but the broken lines in rectangle stop me to do this. due to the high density rectangles in figure, so I want to connect broken lines, but no enlarge line width. Could you help me?
I have tryed to do dilate/erode/open/close mask operations, but they all can’t meet my request. I need to fill rectangle(run fill holes), but the broken lines in rectangle stop me to do this. due to the high density rectangles in figure, so I want to connect broken lines, but no enlarge line width. Could you help me?
I have tryed to do dilate/erode/open/close mask operations, but they all can’t meet my request. image processing, image segmentation MATLAB Answers — New Questions
Problem with converting uitable to table (array2table) with strange number of column names
Hello, I have a UITable that on startup has 4 columns.
I want to create some dummy data (3 columns) and play with the different save options (writecell, writematrix and writetable) to see which one handles NaNs the best and can save the column names.
I am hence steering towards writetable.
However, when I clear the table and re-enter my dummy data via:
uit=app.UITable;
uit.Data=[];
r = randi([0,10],10,3)
uit.Data = [r];
I notice that the number of column names is still 4 and not 3, yet the data size in columns is 3!
T=app.UITable;
vn=T.ColumnName
vn = %UITable Column Names
4×1 cell array
{‘Column 1’}
{‘Column 2’}
{‘Column 3’}
{‘Column 4’}
ans = % UITable Data size
10 3
hence the following fails
T = array2table(data, ‘VariableNames’,vn’)
Error using array2table
The VariableNames property must contain one name for each variable in the table.
Any suggestions please?
(and a 2nd question, most of the time my data is doubles, however occasionally its a cell array – when I want e.g. some text. I assume the only chnage I would need is when creating the table I would use cell2table instead of array2table?)Hello, I have a UITable that on startup has 4 columns.
I want to create some dummy data (3 columns) and play with the different save options (writecell, writematrix and writetable) to see which one handles NaNs the best and can save the column names.
I am hence steering towards writetable.
However, when I clear the table and re-enter my dummy data via:
uit=app.UITable;
uit.Data=[];
r = randi([0,10],10,3)
uit.Data = [r];
I notice that the number of column names is still 4 and not 3, yet the data size in columns is 3!
T=app.UITable;
vn=T.ColumnName
vn = %UITable Column Names
4×1 cell array
{‘Column 1’}
{‘Column 2’}
{‘Column 3’}
{‘Column 4’}
ans = % UITable Data size
10 3
hence the following fails
T = array2table(data, ‘VariableNames’,vn’)
Error using array2table
The VariableNames property must contain one name for each variable in the table.
Any suggestions please?
(and a 2nd question, most of the time my data is doubles, however occasionally its a cell array – when I want e.g. some text. I assume the only chnage I would need is when creating the table I would use cell2table instead of array2table?) Hello, I have a UITable that on startup has 4 columns.
I want to create some dummy data (3 columns) and play with the different save options (writecell, writematrix and writetable) to see which one handles NaNs the best and can save the column names.
I am hence steering towards writetable.
However, when I clear the table and re-enter my dummy data via:
uit=app.UITable;
uit.Data=[];
r = randi([0,10],10,3)
uit.Data = [r];
I notice that the number of column names is still 4 and not 3, yet the data size in columns is 3!
T=app.UITable;
vn=T.ColumnName
vn = %UITable Column Names
4×1 cell array
{‘Column 1’}
{‘Column 2’}
{‘Column 3’}
{‘Column 4’}
ans = % UITable Data size
10 3
hence the following fails
T = array2table(data, ‘VariableNames’,vn’)
Error using array2table
The VariableNames property must contain one name for each variable in the table.
Any suggestions please?
(and a 2nd question, most of the time my data is doubles, however occasionally its a cell array – when I want e.g. some text. I assume the only chnage I would need is when creating the table I would use cell2table instead of array2table?) uitable, array2table, writetable MATLAB Answers — New Questions
Who can give me a full answer of this question?
Write a program which repeatedly reads numbers until the user enters "done". Once "done" is
entered, print out the Max and Min. Use an array to store all the numbers. Example of execution:
Enter a number: 4
Enter a number: 5
Enter a number: 9
Enter a number: done
Max = 9, Min = 4Write a program which repeatedly reads numbers until the user enters "done". Once "done" is
entered, print out the Max and Min. Use an array to store all the numbers. Example of execution:
Enter a number: 4
Enter a number: 5
Enter a number: 9
Enter a number: done
Max = 9, Min = 4 Write a program which repeatedly reads numbers until the user enters "done". Once "done" is
entered, print out the Max and Min. Use an array to store all the numbers. Example of execution:
Enter a number: 4
Enter a number: 5
Enter a number: 9
Enter a number: done
Max = 9, Min = 4 homework MATLAB Answers — New Questions
Out of Memory during serialization of the subsystem data – reinforcement learning
Hi, during training (reinforcement learning), agents aren’t saved properly and this warning is given. What can be done to fix this? Training is done with parallel processing.Hi, during training (reinforcement learning), agents aren’t saved properly and this warning is given. What can be done to fix this? Training is done with parallel processing. Hi, during training (reinforcement learning), agents aren’t saved properly and this warning is given. What can be done to fix this? Training is done with parallel processing. reinforcement learning MATLAB Answers — New Questions
function pdepe coder generation
Hi all,
I am trying to generate a dynamic library file by using ‘coder’. When I trying to do it, there is an information said that the function ‘pdepe’ is not supported in code generation. I am wondering if there is any solution to it like a replacement of the ‘pdepe’ function or some other settings?
Thank you in advanceHi all,
I am trying to generate a dynamic library file by using ‘coder’. When I trying to do it, there is an information said that the function ‘pdepe’ is not supported in code generation. I am wondering if there is any solution to it like a replacement of the ‘pdepe’ function or some other settings?
Thank you in advance Hi all,
I am trying to generate a dynamic library file by using ‘coder’. When I trying to do it, there is an information said that the function ‘pdepe’ is not supported in code generation. I am wondering if there is any solution to it like a replacement of the ‘pdepe’ function or some other settings?
Thank you in advance code generation, pdepe, matlab, coder MATLAB Answers — New Questions
complex gaussian noise generation
how can i generate a complex gaussian noise with zero mean and some variance in matlab?how can i generate a complex gaussian noise with zero mean and some variance in matlab? how can i generate a complex gaussian noise with zero mean and some variance in matlab? a, f MATLAB Answers — New Questions
error with configuring android studio with matlab
So i have been trying to configure matlab to work with android studio for a project and i came across Simulink Support Package for Android Devices ,but when i try to configure it i get this error message. Does anyone know how to fix this
Build App
A problem occurred configuring root project ‘TestApp’. > Could not open cp_proj generic class cache for build file ‘C:UsersUserAppDataLocalTemptpee9cd55b_8ffa_4e98_82dc_4f945f5ab51cTestAppbuild.gradle’ (C:UsersUser.gradlecaches7.5scripts56lbh5pj36js9453y7f1h6iim). > BUG! exception in phase ‘semantic analysis’ in source unit ‘_BuildScript_’ Unsupported class file major version 65 *So i have been trying to configure matlab to work with android studio for a project and i came across Simulink Support Package for Android Devices ,but when i try to configure it i get this error message. Does anyone know how to fix this
Build App
A problem occurred configuring root project ‘TestApp’. > Could not open cp_proj generic class cache for build file ‘C:UsersUserAppDataLocalTemptpee9cd55b_8ffa_4e98_82dc_4f945f5ab51cTestAppbuild.gradle’ (C:UsersUser.gradlecaches7.5scripts56lbh5pj36js9453y7f1h6iim). > BUG! exception in phase ‘semantic analysis’ in source unit ‘_BuildScript_’ Unsupported class file major version 65 * So i have been trying to configure matlab to work with android studio for a project and i came across Simulink Support Package for Android Devices ,but when i try to configure it i get this error message. Does anyone know how to fix this
Build App
A problem occurred configuring root project ‘TestApp’. > Could not open cp_proj generic class cache for build file ‘C:UsersUserAppDataLocalTemptpee9cd55b_8ffa_4e98_82dc_4f945f5ab51cTestAppbuild.gradle’ (C:UsersUser.gradlecaches7.5scripts56lbh5pj36js9453y7f1h6iim). > BUG! exception in phase ‘semantic analysis’ in source unit ‘_BuildScript_’ Unsupported class file major version 65 * android studio MATLAB Answers — New Questions
how to set the browser of webread function?
Hi Matlab,
I plan to use webread to get the data from a website. I can open the website in Chrome, yet I get the message "The currently used browser has security risks". It seems the website prevents the default matlab browser to read the data. Is it possible to change the browser used by webread to Chrome?Hi Matlab,
I plan to use webread to get the data from a website. I can open the website in Chrome, yet I get the message "The currently used browser has security risks". It seems the website prevents the default matlab browser to read the data. Is it possible to change the browser used by webread to Chrome? Hi Matlab,
I plan to use webread to get the data from a website. I can open the website in Chrome, yet I get the message "The currently used browser has security risks". It seems the website prevents the default matlab browser to read the data. Is it possible to change the browser used by webread to Chrome? webread, browser MATLAB Answers — New Questions
Fixed final time and fixed final state optimal control problem
Hello, someboddy help me please with this optimal control problem of fixed end time and fixed end point using Pontryagin Minimum Principle
State equation
dx1(t)/dt = – (1/N)*d*x1(t)*x3(t) – u1*x1(t)
dx2(t)/dt = (1/N)*x1(t)*x3(t) – a*x2(t) – u2*x2(t)
dx3(t)/dt = a*x2(t) – b*x3(t) – u3*x3(t)
dx4(t)/dt = b*x3(t) – u4*x4(t)
with N=651
a=0.2
b=0.3
d=0.5
x1(0)=651 x1(T)=148
x2(0)=279 x2(T)=85
x3(0)=130 x3(T)=80
x4(0)=75 x4(T)=252
with T= 29
cost function minimize J = integral from 0 to 29 of 0.5*x1^2 + 0.5*x2^2 + 0.5*x3^2 + 0.5*x4^2 + 0.5*u1^2 + 0.5*u2^2 + 0.5*u3^2 + 0.5*u4^2
please help me with matlab coding
thank you very much
I appreciate for your helpHello, someboddy help me please with this optimal control problem of fixed end time and fixed end point using Pontryagin Minimum Principle
State equation
dx1(t)/dt = – (1/N)*d*x1(t)*x3(t) – u1*x1(t)
dx2(t)/dt = (1/N)*x1(t)*x3(t) – a*x2(t) – u2*x2(t)
dx3(t)/dt = a*x2(t) – b*x3(t) – u3*x3(t)
dx4(t)/dt = b*x3(t) – u4*x4(t)
with N=651
a=0.2
b=0.3
d=0.5
x1(0)=651 x1(T)=148
x2(0)=279 x2(T)=85
x3(0)=130 x3(T)=80
x4(0)=75 x4(T)=252
with T= 29
cost function minimize J = integral from 0 to 29 of 0.5*x1^2 + 0.5*x2^2 + 0.5*x3^2 + 0.5*x4^2 + 0.5*u1^2 + 0.5*u2^2 + 0.5*u3^2 + 0.5*u4^2
please help me with matlab coding
thank you very much
I appreciate for your help Hello, someboddy help me please with this optimal control problem of fixed end time and fixed end point using Pontryagin Minimum Principle
State equation
dx1(t)/dt = – (1/N)*d*x1(t)*x3(t) – u1*x1(t)
dx2(t)/dt = (1/N)*x1(t)*x3(t) – a*x2(t) – u2*x2(t)
dx3(t)/dt = a*x2(t) – b*x3(t) – u3*x3(t)
dx4(t)/dt = b*x3(t) – u4*x4(t)
with N=651
a=0.2
b=0.3
d=0.5
x1(0)=651 x1(T)=148
x2(0)=279 x2(T)=85
x3(0)=130 x3(T)=80
x4(0)=75 x4(T)=252
with T= 29
cost function minimize J = integral from 0 to 29 of 0.5*x1^2 + 0.5*x2^2 + 0.5*x3^2 + 0.5*x4^2 + 0.5*u1^2 + 0.5*u2^2 + 0.5*u3^2 + 0.5*u4^2
please help me with matlab coding
thank you very much
I appreciate for your help control, pontryagin MATLAB Answers — New Questions
Two dimensional instantenious velocity field of an axisimetric turbulent free jet is provided in the file Jet_0001.txt. The jet nozzel diameter is Djet = 0.01 m and the centerline of the jet is located at y0 = 0.25 m. The jet velocity at the nozzle i
Two dimensional instantenious velocity field of an axisimetric turbulent free jet is provided in the file Jet_0001.txt. The jet nozzel diameter is Djet = 0.01 m and the centerline of the jet is located at y0 = 0.25 m. The jet velocity at the nozzle is Ujet = 3 m/s. Velocity data is obtained using particle image velocimetry (PIV) technique in the central plane of the jet. The data file consists of four columns organized as follows x-coordinate (m) y-coordinate (m) u-velocity (uins, m/s) v-velocity (vins, m/s) Note: The size of the array is 127 × 127 = 16129 Using MATLAB or any other software available a) Plot the instantenious velocity vector field in x-y plane. Normalize x, and y axis with Djet. b) Plot the contours of the the streamwise velocity, uins /Ujet and show the colormap with appropriate labels. c) Where is the maximum uins located? Explain. d) Calculate the vorticity component z. For this purpose, develop a code to calculate z numerically. Use the finite diffenrece approximation to calculate velocity gradients. Submit your code and comment on the regions of high vorticity.Two dimensional instantenious velocity field of an axisimetric turbulent free jet is provided in the file Jet_0001.txt. The jet nozzel diameter is Djet = 0.01 m and the centerline of the jet is located at y0 = 0.25 m. The jet velocity at the nozzle is Ujet = 3 m/s. Velocity data is obtained using particle image velocimetry (PIV) technique in the central plane of the jet. The data file consists of four columns organized as follows x-coordinate (m) y-coordinate (m) u-velocity (uins, m/s) v-velocity (vins, m/s) Note: The size of the array is 127 × 127 = 16129 Using MATLAB or any other software available a) Plot the instantenious velocity vector field in x-y plane. Normalize x, and y axis with Djet. b) Plot the contours of the the streamwise velocity, uins /Ujet and show the colormap with appropriate labels. c) Where is the maximum uins located? Explain. d) Calculate the vorticity component z. For this purpose, develop a code to calculate z numerically. Use the finite diffenrece approximation to calculate velocity gradients. Submit your code and comment on the regions of high vorticity. Two dimensional instantenious velocity field of an axisimetric turbulent free jet is provided in the file Jet_0001.txt. The jet nozzel diameter is Djet = 0.01 m and the centerline of the jet is located at y0 = 0.25 m. The jet velocity at the nozzle is Ujet = 3 m/s. Velocity data is obtained using particle image velocimetry (PIV) technique in the central plane of the jet. The data file consists of four columns organized as follows x-coordinate (m) y-coordinate (m) u-velocity (uins, m/s) v-velocity (vins, m/s) Note: The size of the array is 127 × 127 = 16129 Using MATLAB or any other software available a) Plot the instantenious velocity vector field in x-y plane. Normalize x, and y axis with Djet. b) Plot the contours of the the streamwise velocity, uins /Ujet and show the colormap with appropriate labels. c) Where is the maximum uins located? Explain. d) Calculate the vorticity component z. For this purpose, develop a code to calculate z numerically. Use the finite diffenrece approximation to calculate velocity gradients. Submit your code and comment on the regions of high vorticity. fluid mechanics MATLAB Answers — New Questions
Can i simulate cloud environment using MATLAB?
I want to simulate cloud environment using MATLAB and implement some scheduling algorithms.I want to simulate cloud environment using MATLAB and implement some scheduling algorithms. I want to simulate cloud environment using MATLAB and implement some scheduling algorithms. cloud computing, scheduling algorithms MATLAB Answers — New Questions
i have a matlab code with 3 for loops, in last for loop , there is threshold based penalization. i want trace some variables in that code and compare with plot
respected professor.
i have code with 3 for loops. 1st for delta (which gives different plots in the same figure) 2nd for eps ( which is on x axis of figure) 3rd for Nt, giving different alpha .and in the 3rd loop pout1 and pout2 is also found which is used in threshold based penalization.
i am giving the threshold based penalization problem as screenshot as well as the figure .
i have the code for generating the figure. and i am attaching the code also.
i want to trace the value of delta, eps , Nt, alpha, pout1, pout2 and get the new alpha which is in the plot and compare these values from plot.
Thank you in advancerespected professor.
i have code with 3 for loops. 1st for delta (which gives different plots in the same figure) 2nd for eps ( which is on x axis of figure) 3rd for Nt, giving different alpha .and in the 3rd loop pout1 and pout2 is also found which is used in threshold based penalization.
i am giving the threshold based penalization problem as screenshot as well as the figure .
i have the code for generating the figure. and i am attaching the code also.
i want to trace the value of delta, eps , Nt, alpha, pout1, pout2 and get the new alpha which is in the plot and compare these values from plot.
Thank you in advance respected professor.
i have code with 3 for loops. 1st for delta (which gives different plots in the same figure) 2nd for eps ( which is on x axis of figure) 3rd for Nt, giving different alpha .and in the 3rd loop pout1 and pout2 is also found which is used in threshold based penalization.
i am giving the threshold based penalization problem as screenshot as well as the figure .
i have the code for generating the figure. and i am attaching the code also.
i want to trace the value of delta, eps , Nt, alpha, pout1, pout2 and get the new alpha which is in the plot and compare these values from plot.
Thank you in advance threshold based penalization, tracing code MATLAB Answers — New Questions
Why there’s opposite fit results phenomenon between the oddnomial and the evennmnial?
p=polyfit(RANKING,Total,4);
y=polyval(p,Total);
plot(y)p=polyfit(RANKING,Total,4);
y=polyval(p,Total);
plot(y) p=polyfit(RANKING,Total,4);
y=polyval(p,Total);
plot(y) polyfit MATLAB Answers — New Questions
What are the point locations for EHfields() function output?
When I run the EHfields function like this:
[e,h] = EHfields(antenna_object,frequency)
The size of the output e is 3 * 441. Where 3 is the x,y and z component of the computed electric field.
When I run the function like this:
[eh,~]=EHfields(antenna_object,frequency, Polarization="H");
The size of the output eh is 1 * 441. Where 1 is the horizontal compoenent of the computed electric field.
My question is the 441. I am guessing that it is the index of the points evaluated as a unit sphere around the antenna. But in what ordered are they counted?
From Antenna Toolbox Coordinate Sytem it could be that it is counted from the azimuth angle from the positive x-axis to the vector’s orthogonal projection onto the xy plane, moving in the direction towards the y-axis and ranges from –180 and 180 degrees, and the elevation angle from the vector’s orthogonal projection on the xy plane toward the positive z-axis and ranges from –90 and 90 degrees.
But I don’t know for sure. I cannot find documentation clearifying how exactly are these points ordered, spaced and located. Perhaps a staff’s answer can be much helpful?
ThanksWhen I run the EHfields function like this:
[e,h] = EHfields(antenna_object,frequency)
The size of the output e is 3 * 441. Where 3 is the x,y and z component of the computed electric field.
When I run the function like this:
[eh,~]=EHfields(antenna_object,frequency, Polarization="H");
The size of the output eh is 1 * 441. Where 1 is the horizontal compoenent of the computed electric field.
My question is the 441. I am guessing that it is the index of the points evaluated as a unit sphere around the antenna. But in what ordered are they counted?
From Antenna Toolbox Coordinate Sytem it could be that it is counted from the azimuth angle from the positive x-axis to the vector’s orthogonal projection onto the xy plane, moving in the direction towards the y-axis and ranges from –180 and 180 degrees, and the elevation angle from the vector’s orthogonal projection on the xy plane toward the positive z-axis and ranges from –90 and 90 degrees.
But I don’t know for sure. I cannot find documentation clearifying how exactly are these points ordered, spaced and located. Perhaps a staff’s answer can be much helpful?
Thanks When I run the EHfields function like this:
[e,h] = EHfields(antenna_object,frequency)
The size of the output e is 3 * 441. Where 3 is the x,y and z component of the computed electric field.
When I run the function like this:
[eh,~]=EHfields(antenna_object,frequency, Polarization="H");
The size of the output eh is 1 * 441. Where 1 is the horizontal compoenent of the computed electric field.
My question is the 441. I am guessing that it is the index of the points evaluated as a unit sphere around the antenna. But in what ordered are they counted?
From Antenna Toolbox Coordinate Sytem it could be that it is counted from the azimuth angle from the positive x-axis to the vector’s orthogonal projection onto the xy plane, moving in the direction towards the y-axis and ranges from –180 and 180 degrees, and the elevation angle from the vector’s orthogonal projection on the xy plane toward the positive z-axis and ranges from –90 and 90 degrees.
But I don’t know for sure. I cannot find documentation clearifying how exactly are these points ordered, spaced and located. Perhaps a staff’s answer can be much helpful?
Thanks function, antenna, coordinate system MATLAB Answers — New Questions
interpolating from a 3D structure
Hi all
I have three vectors, named X,Y, and Z, related to the coordinates of a structure and also a vector named W showing the displacement of each node. My structure using scatter3 is like this. I’m gonna interpolate it to obtain an 3D image. How should I interpolate such an irregular shape?Hi all
I have three vectors, named X,Y, and Z, related to the coordinates of a structure and also a vector named W showing the displacement of each node. My structure using scatter3 is like this. I’m gonna interpolate it to obtain an 3D image. How should I interpolate such an irregular shape? Hi all
I have three vectors, named X,Y, and Z, related to the coordinates of a structure and also a vector named W showing the displacement of each node. My structure using scatter3 is like this. I’m gonna interpolate it to obtain an 3D image. How should I interpolate such an irregular shape? interpolate MATLAB Answers — New Questions
MATLAB Code Not Plotting Solution and Stuck on “Busy”
Hello,
I’m working on a MATLAB script to plot a solution, but the program gets stuck, continuously showing "Busy" in the status bar, and no plot is generated. I’ve checked my code for errors but haven’t found any obvious issues. What could be causing this behavior, and how can I resolve it?
Thank you for your help!
clear clc;
lambda1=0.4*1i;
lambda2 = 0; lambda3 =0; lambda4 = -1*1i; a =1; x =-0.001;
[A1, B2] = deal(1);
[A2, B1] = deal(0);
[A3, B4] = deal(1.2);
[A4, B3] = deal(1.5);
t = linspace(-10, 10, 800); % Adjust the range and number of points as needed
y = linspace(-10, 10, 800);
r1=zeros(length(x), length(y), length(t));
for k=1:length(x)
for l=1:length(t)
for m=1:length(y)
X1 = exp(-lambda1*a*y(m)*1i + t(l)*1i./(2*lambda1) + A1*(x(k) + y(m) + t(l)).^2);
X2 = exp(-lambda2*a*y(m)*1i + t(l)*1i./(2*lambda2) + A2*(x(k) + y(m) + t(l)).^2);
X3 = exp(-lambda3*a*y(m)*1i + t(l)*1i./(2*lambda3) + A3*(x(k) + y(m) + t(l)).^2);
X4 = exp(-lambda4*a*y(m)*1i + t(l)*1i./(2*lambda4) + A4*(x(k) + y(m) + t(l)).^2);
Y1 = exp(lambda1*a*y(m)*1i – t(l)*1i./(2*lambda1) + B1*(x(k) + y(m) + t(l)).^2);
Y2 = exp(lambda2*a*y(m)*1i – t(l)*1i./(2*lambda2) + B2*(x(k) + y(m) + t(l)).^2);
Y3 = exp(lambda3*a*y(m)*1i – t(l)*1i./(2*lambda3) + B3*(x(k) + y(m) + t(l)).^2);
Y4 = exp(lambda4*a*y(m)*1i – t(l)*1i./(2*lambda4) + B4*(x(k) + y(m) + t(l)).^2);
q2num = [X1 X2 X2 X4 0; Y1 Y2 Y3 Y4 0; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4 1; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4 0; X1./(lambda1.^2) X2./(lambda2.^2) X3./(lambda3.^2) X4./(lambda4.^2) 0];
den = [X1 X2 X2 X4; Y1 Y2 Y3 Y4; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4];
r1(l,m,k)= ((det(q2num)./det(den)));
end
end
end
[dr1dx, dr1dy, dr1dt] = gradient(r1);
dr1dx = dr1dx/mean(diff(x));
dr1dy = dr1dy/mean(diff(y));
dr1dt = dr1dt/mean(diff(t));
p1=a + 1i*(dr1dy – dr1dx);
figure (1)
surf(y,t,abs(p1));
view(45,60);Hello,
I’m working on a MATLAB script to plot a solution, but the program gets stuck, continuously showing "Busy" in the status bar, and no plot is generated. I’ve checked my code for errors but haven’t found any obvious issues. What could be causing this behavior, and how can I resolve it?
Thank you for your help!
clear clc;
lambda1=0.4*1i;
lambda2 = 0; lambda3 =0; lambda4 = -1*1i; a =1; x =-0.001;
[A1, B2] = deal(1);
[A2, B1] = deal(0);
[A3, B4] = deal(1.2);
[A4, B3] = deal(1.5);
t = linspace(-10, 10, 800); % Adjust the range and number of points as needed
y = linspace(-10, 10, 800);
r1=zeros(length(x), length(y), length(t));
for k=1:length(x)
for l=1:length(t)
for m=1:length(y)
X1 = exp(-lambda1*a*y(m)*1i + t(l)*1i./(2*lambda1) + A1*(x(k) + y(m) + t(l)).^2);
X2 = exp(-lambda2*a*y(m)*1i + t(l)*1i./(2*lambda2) + A2*(x(k) + y(m) + t(l)).^2);
X3 = exp(-lambda3*a*y(m)*1i + t(l)*1i./(2*lambda3) + A3*(x(k) + y(m) + t(l)).^2);
X4 = exp(-lambda4*a*y(m)*1i + t(l)*1i./(2*lambda4) + A4*(x(k) + y(m) + t(l)).^2);
Y1 = exp(lambda1*a*y(m)*1i – t(l)*1i./(2*lambda1) + B1*(x(k) + y(m) + t(l)).^2);
Y2 = exp(lambda2*a*y(m)*1i – t(l)*1i./(2*lambda2) + B2*(x(k) + y(m) + t(l)).^2);
Y3 = exp(lambda3*a*y(m)*1i – t(l)*1i./(2*lambda3) + B3*(x(k) + y(m) + t(l)).^2);
Y4 = exp(lambda4*a*y(m)*1i – t(l)*1i./(2*lambda4) + B4*(x(k) + y(m) + t(l)).^2);
q2num = [X1 X2 X2 X4 0; Y1 Y2 Y3 Y4 0; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4 1; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4 0; X1./(lambda1.^2) X2./(lambda2.^2) X3./(lambda3.^2) X4./(lambda4.^2) 0];
den = [X1 X2 X2 X4; Y1 Y2 Y3 Y4; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4];
r1(l,m,k)= ((det(q2num)./det(den)));
end
end
end
[dr1dx, dr1dy, dr1dt] = gradient(r1);
dr1dx = dr1dx/mean(diff(x));
dr1dy = dr1dy/mean(diff(y));
dr1dt = dr1dt/mean(diff(t));
p1=a + 1i*(dr1dy – dr1dx);
figure (1)
surf(y,t,abs(p1));
view(45,60); Hello,
I’m working on a MATLAB script to plot a solution, but the program gets stuck, continuously showing "Busy" in the status bar, and no plot is generated. I’ve checked my code for errors but haven’t found any obvious issues. What could be causing this behavior, and how can I resolve it?
Thank you for your help!
clear clc;
lambda1=0.4*1i;
lambda2 = 0; lambda3 =0; lambda4 = -1*1i; a =1; x =-0.001;
[A1, B2] = deal(1);
[A2, B1] = deal(0);
[A3, B4] = deal(1.2);
[A4, B3] = deal(1.5);
t = linspace(-10, 10, 800); % Adjust the range and number of points as needed
y = linspace(-10, 10, 800);
r1=zeros(length(x), length(y), length(t));
for k=1:length(x)
for l=1:length(t)
for m=1:length(y)
X1 = exp(-lambda1*a*y(m)*1i + t(l)*1i./(2*lambda1) + A1*(x(k) + y(m) + t(l)).^2);
X2 = exp(-lambda2*a*y(m)*1i + t(l)*1i./(2*lambda2) + A2*(x(k) + y(m) + t(l)).^2);
X3 = exp(-lambda3*a*y(m)*1i + t(l)*1i./(2*lambda3) + A3*(x(k) + y(m) + t(l)).^2);
X4 = exp(-lambda4*a*y(m)*1i + t(l)*1i./(2*lambda4) + A4*(x(k) + y(m) + t(l)).^2);
Y1 = exp(lambda1*a*y(m)*1i – t(l)*1i./(2*lambda1) + B1*(x(k) + y(m) + t(l)).^2);
Y2 = exp(lambda2*a*y(m)*1i – t(l)*1i./(2*lambda2) + B2*(x(k) + y(m) + t(l)).^2);
Y3 = exp(lambda3*a*y(m)*1i – t(l)*1i./(2*lambda3) + B3*(x(k) + y(m) + t(l)).^2);
Y4 = exp(lambda4*a*y(m)*1i – t(l)*1i./(2*lambda4) + B4*(x(k) + y(m) + t(l)).^2);
q2num = [X1 X2 X2 X4 0; Y1 Y2 Y3 Y4 0; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4 1; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4 0; X1./(lambda1.^2) X2./(lambda2.^2) X3./(lambda3.^2) X4./(lambda4.^2) 0];
den = [X1 X2 X2 X4; Y1 Y2 Y3 Y4; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4];
r1(l,m,k)= ((det(q2num)./det(den)));
end
end
end
[dr1dx, dr1dy, dr1dt] = gradient(r1);
dr1dx = dr1dx/mean(diff(x));
dr1dy = dr1dy/mean(diff(y));
dr1dt = dr1dt/mean(diff(t));
p1=a + 1i*(dr1dy – dr1dx);
figure (1)
surf(y,t,abs(p1));
view(45,60); surface, 3d plots MATLAB Answers — New Questions
How Can I Create More Than One Figure
I can tell Matlab to make a basic figure such as a plot of ‘x’ versus ‘y’, but when I tell Matlab to make more than one figure in the same script, it will delete my first figure when it makes the next one. Do I need to tell Matlab to save each figure after it creates it and before making the next one? or am I missing something very obvious?I can tell Matlab to make a basic figure such as a plot of ‘x’ versus ‘y’, but when I tell Matlab to make more than one figure in the same script, it will delete my first figure when it makes the next one. Do I need to tell Matlab to save each figure after it creates it and before making the next one? or am I missing something very obvious? I can tell Matlab to make a basic figure such as a plot of ‘x’ versus ‘y’, but when I tell Matlab to make more than one figure in the same script, it will delete my first figure when it makes the next one. Do I need to tell Matlab to save each figure after it creates it and before making the next one? or am I missing something very obvious? figure, subplot MATLAB Answers — New Questions
Change the material of th disque and the shaft
Hi every one ;
I’m just wanna ask you please, about including in a matlab code the change of matérials of the shaft and the disc, the bearing characteristics!!
even the unbalance.
nd thanks in advance !!Hi every one ;
I’m just wanna ask you please, about including in a matlab code the change of matérials of the shaft and the disc, the bearing characteristics!!
even the unbalance.
nd thanks in advance !! Hi every one ;
I’m just wanna ask you please, about including in a matlab code the change of matérials of the shaft and the disc, the bearing characteristics!!
even the unbalance.
nd thanks in advance !! materials, shaft charactéristics MATLAB Answers — New Questions
NaN values when attempting Motion Read for a UAV Scenario
I’m currently attempting to get platform or sensor related motion data from my UAV 3d scenario Simulink Model. Attached is the current block diagram:
I have the UAV scenario configuration block, the SImulation 3D scene configuration block, and the UAV Scenario Motion Read block, connected to my workspace as shown above. The UAV scenario block is configured for the singleUAVScenario function, which spawns a single quadrotor. The control part and this configuration were taken from an example in MATLAB’s documentation, so all bus, signal, and data blocks’ names are unchanged. When I run the model, initially the values are updating, as shown:
However, more or less after a single second passes in my simulation, for some reason, my data goes to NaN values for the rest of the simulation, no matter how long it is, as shown here:
Obviously, when I take the data to MATLAB using a To Workspace block, I have the same issue.
I’ve tried running another MATLAB example; quick access for that is this:
openExample(‘uav/SimulateUAVScenarioUsingScenarioBlocksExample’)
In that simulink model, the displays constantly update and there are no nan issues. Can anyone provide any answers? Sorry if it’s an easy fix, I don’t have too much experience in this particular area. Is it the sampling time, some inherent issue? I’m assuming that, according to the matlab documentation for the UAV scenario configuration block…
This block internally stores motion states from platforms and sensors in a global data store memory block as buses within a bus with a name specified in the Scenario motion bus name parameter.
That the motion parameters are automatically stored in this global data store memory block, and by using the read block, I can simply get the motion data. Do let me know if any additional information is needed, I can provide.
Note: Data goes to NaN after an exact second in simulation time has elapsed. No matter what the simulation step size is, the data seems constant except for the Position data for the first second, but instantly after, everything goes to NaN (except platform ID). The constant data also may be wrong, I suspect.I’m currently attempting to get platform or sensor related motion data from my UAV 3d scenario Simulink Model. Attached is the current block diagram:
I have the UAV scenario configuration block, the SImulation 3D scene configuration block, and the UAV Scenario Motion Read block, connected to my workspace as shown above. The UAV scenario block is configured for the singleUAVScenario function, which spawns a single quadrotor. The control part and this configuration were taken from an example in MATLAB’s documentation, so all bus, signal, and data blocks’ names are unchanged. When I run the model, initially the values are updating, as shown:
However, more or less after a single second passes in my simulation, for some reason, my data goes to NaN values for the rest of the simulation, no matter how long it is, as shown here:
Obviously, when I take the data to MATLAB using a To Workspace block, I have the same issue.
I’ve tried running another MATLAB example; quick access for that is this:
openExample(‘uav/SimulateUAVScenarioUsingScenarioBlocksExample’)
In that simulink model, the displays constantly update and there are no nan issues. Can anyone provide any answers? Sorry if it’s an easy fix, I don’t have too much experience in this particular area. Is it the sampling time, some inherent issue? I’m assuming that, according to the matlab documentation for the UAV scenario configuration block…
This block internally stores motion states from platforms and sensors in a global data store memory block as buses within a bus with a name specified in the Scenario motion bus name parameter.
That the motion parameters are automatically stored in this global data store memory block, and by using the read block, I can simply get the motion data. Do let me know if any additional information is needed, I can provide.
Note: Data goes to NaN after an exact second in simulation time has elapsed. No matter what the simulation step size is, the data seems constant except for the Position data for the first second, but instantly after, everything goes to NaN (except platform ID). The constant data also may be wrong, I suspect. I’m currently attempting to get platform or sensor related motion data from my UAV 3d scenario Simulink Model. Attached is the current block diagram:
I have the UAV scenario configuration block, the SImulation 3D scene configuration block, and the UAV Scenario Motion Read block, connected to my workspace as shown above. The UAV scenario block is configured for the singleUAVScenario function, which spawns a single quadrotor. The control part and this configuration were taken from an example in MATLAB’s documentation, so all bus, signal, and data blocks’ names are unchanged. When I run the model, initially the values are updating, as shown:
However, more or less after a single second passes in my simulation, for some reason, my data goes to NaN values for the rest of the simulation, no matter how long it is, as shown here:
Obviously, when I take the data to MATLAB using a To Workspace block, I have the same issue.
I’ve tried running another MATLAB example; quick access for that is this:
openExample(‘uav/SimulateUAVScenarioUsingScenarioBlocksExample’)
In that simulink model, the displays constantly update and there are no nan issues. Can anyone provide any answers? Sorry if it’s an easy fix, I don’t have too much experience in this particular area. Is it the sampling time, some inherent issue? I’m assuming that, according to the matlab documentation for the UAV scenario configuration block…
This block internally stores motion states from platforms and sensors in a global data store memory block as buses within a bus with a name specified in the Scenario motion bus name parameter.
That the motion parameters are automatically stored in this global data store memory block, and by using the read block, I can simply get the motion data. Do let me know if any additional information is needed, I can provide.
Note: Data goes to NaN after an exact second in simulation time has elapsed. No matter what the simulation step size is, the data seems constant except for the Position data for the first second, but instantly after, everything goes to NaN (except platform ID). The constant data also may be wrong, I suspect. uav toolbox, nan values, simulink MATLAB Answers — New Questions
How to import multiple .mat files into the same workspace
Hello,
I have multiple .mat files that contain different arrays.
These arrays have the same name in each .mat file; I need to open two or more .mat files to elaborate the data.
The problem is that the content of the most recent .mat file overwrites the previous one since the name of the arrays is always the same.
For example, let’s say I have test1.mat that contains:
accel
effort
gyro
and test2.mat that contains:
accel
effort
gyro
Is there a way to be able to load into the workspace the arrays coming from test1 and test2 at the same time?Hello,
I have multiple .mat files that contain different arrays.
These arrays have the same name in each .mat file; I need to open two or more .mat files to elaborate the data.
The problem is that the content of the most recent .mat file overwrites the previous one since the name of the arrays is always the same.
For example, let’s say I have test1.mat that contains:
accel
effort
gyro
and test2.mat that contains:
accel
effort
gyro
Is there a way to be able to load into the workspace the arrays coming from test1 and test2 at the same time? Hello,
I have multiple .mat files that contain different arrays.
These arrays have the same name in each .mat file; I need to open two or more .mat files to elaborate the data.
The problem is that the content of the most recent .mat file overwrites the previous one since the name of the arrays is always the same.
For example, let’s say I have test1.mat that contains:
accel
effort
gyro
and test2.mat that contains:
accel
effort
gyro
Is there a way to be able to load into the workspace the arrays coming from test1 and test2 at the same time? matlab, arrays, import MATLAB Answers — New Questions