Tag Archives: matlab
How can I upload files from computer to Matlab Online?
This may be a silly problem ,but I really didn’t find out the solution.Anyway,there’re people saying that you can find a upload button in "Home" Tab,but I really don’t see that.I am just hoping if anyone could show me.
I upload a picture about what I saw in my Matlab Online.Thank you.This may be a silly problem ,but I really didn’t find out the solution.Anyway,there’re people saying that you can find a upload button in "Home" Tab,but I really don’t see that.I am just hoping if anyone could show me.
I upload a picture about what I saw in my Matlab Online.Thank you. This may be a silly problem ,but I really didn’t find out the solution.Anyway,there’re people saying that you can find a upload button in "Home" Tab,but I really don’t see that.I am just hoping if anyone could show me.
I upload a picture about what I saw in my Matlab Online.Thank you. matlab online, matlab_online, distance_learning MATLAB Answers — New Questions
Find faster way than compose to format table
I have a large table of data which needs to be output as a csv and then read into a model. For some reason (which I cannot solve) the model will not take in values with scientific number formating (e.g. very small or large numbers, so 8.8817e-04, rather than 0.000888). To get around this I turn the table into text and use compose, but this is slow as the data are large. I have tried using round, which is fast, but Matlab still displays in scientific notation for some values and these remain in the csv, which does not solve the problem. Any faster ideas welcome!
Here’s an example. Note I know you don’t need all the DateTime info, but it gives the form of the data. In reality I have 30 years of data at least, which is why it is a problem. It also need to use a seperate workstation or HPC as the string/compose lines lead to out of memory problems on my own laptop, even if it can store this size of table ok.
Many thanks!
StartDate=datetime(’01/01/2019 00:00′,’InputFormat’,’dd/MM/yyyy HH:mm’);
EndDate=datetime(’31/10/2020 23:00′,’InputFormat’,’dd/MM/yyyy HH:mm’);
DateTime = StartDate:hours(1):EndDate;
DateTime = DateTime’;
datasize =size(DateTime,1);
No_St = 307;
Data = rand(datasize,No_St);
Test_table = array2table(Data);
Test_table.Time = DateTime;
Test_table = movevars(Test_table,"Time","Before",1);
Table_str = string(Test_table{:,2:end}); %convert to string
Table_str = compose(‘%.6f’,Table_str); %Reduce precisionI have a large table of data which needs to be output as a csv and then read into a model. For some reason (which I cannot solve) the model will not take in values with scientific number formating (e.g. very small or large numbers, so 8.8817e-04, rather than 0.000888). To get around this I turn the table into text and use compose, but this is slow as the data are large. I have tried using round, which is fast, but Matlab still displays in scientific notation for some values and these remain in the csv, which does not solve the problem. Any faster ideas welcome!
Here’s an example. Note I know you don’t need all the DateTime info, but it gives the form of the data. In reality I have 30 years of data at least, which is why it is a problem. It also need to use a seperate workstation or HPC as the string/compose lines lead to out of memory problems on my own laptop, even if it can store this size of table ok.
Many thanks!
StartDate=datetime(’01/01/2019 00:00′,’InputFormat’,’dd/MM/yyyy HH:mm’);
EndDate=datetime(’31/10/2020 23:00′,’InputFormat’,’dd/MM/yyyy HH:mm’);
DateTime = StartDate:hours(1):EndDate;
DateTime = DateTime’;
datasize =size(DateTime,1);
No_St = 307;
Data = rand(datasize,No_St);
Test_table = array2table(Data);
Test_table.Time = DateTime;
Test_table = movevars(Test_table,"Time","Before",1);
Table_str = string(Test_table{:,2:end}); %convert to string
Table_str = compose(‘%.6f’,Table_str); %Reduce precision I have a large table of data which needs to be output as a csv and then read into a model. For some reason (which I cannot solve) the model will not take in values with scientific number formating (e.g. very small or large numbers, so 8.8817e-04, rather than 0.000888). To get around this I turn the table into text and use compose, but this is slow as the data are large. I have tried using round, which is fast, but Matlab still displays in scientific notation for some values and these remain in the csv, which does not solve the problem. Any faster ideas welcome!
Here’s an example. Note I know you don’t need all the DateTime info, but it gives the form of the data. In reality I have 30 years of data at least, which is why it is a problem. It also need to use a seperate workstation or HPC as the string/compose lines lead to out of memory problems on my own laptop, even if it can store this size of table ok.
Many thanks!
StartDate=datetime(’01/01/2019 00:00′,’InputFormat’,’dd/MM/yyyy HH:mm’);
EndDate=datetime(’31/10/2020 23:00′,’InputFormat’,’dd/MM/yyyy HH:mm’);
DateTime = StartDate:hours(1):EndDate;
DateTime = DateTime’;
datasize =size(DateTime,1);
No_St = 307;
Data = rand(datasize,No_St);
Test_table = array2table(Data);
Test_table.Time = DateTime;
Test_table = movevars(Test_table,"Time","Before",1);
Table_str = string(Test_table{:,2:end}); %convert to string
Table_str = compose(‘%.6f’,Table_str); %Reduce precision compose, string, csv MATLAB Answers — New Questions
Which equation is solved with ThermalModel?
With the PDE toolbox, equations of the general form m∂2u∂t2+d∂u∂t−∇·(c∇u)+au=f can be solved. On the other side, I can use the Thermal model object which seems to be very comfortable for solving the heat equation. However, it’s not clearly defined what the parameters stand for. For example, what is ‘HeatFlux’? Is it the variable g in the generalized Neumann boundary condition n · (c∇u)+qu=g? Isn’t there a complete documentation? How can I be sure that the correct problem is solved, when I cannot see the underlying equations?With the PDE toolbox, equations of the general form m∂2u∂t2+d∂u∂t−∇·(c∇u)+au=f can be solved. On the other side, I can use the Thermal model object which seems to be very comfortable for solving the heat equation. However, it’s not clearly defined what the parameters stand for. For example, what is ‘HeatFlux’? Is it the variable g in the generalized Neumann boundary condition n · (c∇u)+qu=g? Isn’t there a complete documentation? How can I be sure that the correct problem is solved, when I cannot see the underlying equations? With the PDE toolbox, equations of the general form m∂2u∂t2+d∂u∂t−∇·(c∇u)+au=f can be solved. On the other side, I can use the Thermal model object which seems to be very comfortable for solving the heat equation. However, it’s not clearly defined what the parameters stand for. For example, what is ‘HeatFlux’? Is it the variable g in the generalized Neumann boundary condition n · (c∇u)+qu=g? Isn’t there a complete documentation? How can I be sure that the correct problem is solved, when I cannot see the underlying equations? thermalmodel, general pde MATLAB Answers — New Questions
How to connect a AR Drone2.0 to MATLAB and fly it.
Hello
I am a student in Japan researching ARDrone2.0.
The other day, my PC broke and I installed a new MATLAB.
Then, when I tried to operate it with "wi-ficontrol" of "AR Drone Simulink Development-Kit V1.1", I was connected to Wi-Fi but the drone did not move.
Is there any other software required to operate the drone?
I would like some support.Hello
I am a student in Japan researching ARDrone2.0.
The other day, my PC broke and I installed a new MATLAB.
Then, when I tried to operate it with "wi-ficontrol" of "AR Drone Simulink Development-Kit V1.1", I was connected to Wi-Fi but the drone did not move.
Is there any other software required to operate the drone?
I would like some support. Hello
I am a student in Japan researching ARDrone2.0.
The other day, my PC broke and I installed a new MATLAB.
Then, when I tried to operate it with "wi-ficontrol" of "AR Drone Simulink Development-Kit V1.1", I was connected to Wi-Fi but the drone did not move.
Is there any other software required to operate the drone?
I would like some support. ardrone, simulink, drone, parrot MATLAB Answers — New Questions
i am trying to find the lqr controller system Transfer function, but getting error as “Arrays have incompatible sizes for this operation.”
% Define system matrices
A = [0 20.95; -709.22 -106.85];
B = [3771.21; 12765.96];
C = [1 0];
D = 0;
% Define the LQR weighting matrices
Q = [0.0057312 0; 0 1]; % Weighting matrix for states
R = 1; % Weighting matrix for control inputs
% Compute LQR gain matrix
K = lqr(A, B, Q, R);
% Augment the system
[n, ~] = size(A);
AA = [A, zeros(n, 1); -C, 0];
BB = [B; 0];
% Construct the closed-loop system
Ac = AA – BB * K;
Bc = BB;
Cc = C;
Dc = D;
% Create state-space model of the closed-loop system
sys_cl = ss(Ac, Bc, Cc, Dc);
% Convert state-space model to transfer function
sys_tf = tf(sys_cl);
% Display the transfer function
disp(‘Transfer Function of the Closed-Loop System with LQR Controller:’);
disp(sys_tf);% Define system matrices
A = [0 20.95; -709.22 -106.85];
B = [3771.21; 12765.96];
C = [1 0];
D = 0;
% Define the LQR weighting matrices
Q = [0.0057312 0; 0 1]; % Weighting matrix for states
R = 1; % Weighting matrix for control inputs
% Compute LQR gain matrix
K = lqr(A, B, Q, R);
% Augment the system
[n, ~] = size(A);
AA = [A, zeros(n, 1); -C, 0];
BB = [B; 0];
% Construct the closed-loop system
Ac = AA – BB * K;
Bc = BB;
Cc = C;
Dc = D;
% Create state-space model of the closed-loop system
sys_cl = ss(Ac, Bc, Cc, Dc);
% Convert state-space model to transfer function
sys_tf = tf(sys_cl);
% Display the transfer function
disp(‘Transfer Function of the Closed-Loop System with LQR Controller:’);
disp(sys_tf); % Define system matrices
A = [0 20.95; -709.22 -106.85];
B = [3771.21; 12765.96];
C = [1 0];
D = 0;
% Define the LQR weighting matrices
Q = [0.0057312 0; 0 1]; % Weighting matrix for states
R = 1; % Weighting matrix for control inputs
% Compute LQR gain matrix
K = lqr(A, B, Q, R);
% Augment the system
[n, ~] = size(A);
AA = [A, zeros(n, 1); -C, 0];
BB = [B; 0];
% Construct the closed-loop system
Ac = AA – BB * K;
Bc = BB;
Cc = C;
Dc = D;
% Create state-space model of the closed-loop system
sys_cl = ss(Ac, Bc, Cc, Dc);
% Convert state-space model to transfer function
sys_tf = tf(sys_cl);
% Display the transfer function
disp(‘Transfer Function of the Closed-Loop System with LQR Controller:’);
disp(sys_tf); lqr controller transfer function MATLAB Answers — New Questions
can you segment with the 3D unet an image with unequal dimensions, like 128x384x128 for example as an input to the model?
I am using the unet 3d segmentation matlab built in function. tyoical inputs to that function is equal spaced dimentioons of 32, 64, 128, 256, and so on. can i input an image of size 128x384x128 to the unet function. if not then why?I am using the unet 3d segmentation matlab built in function. tyoical inputs to that function is equal spaced dimentioons of 32, 64, 128, 256, and so on. can i input an image of size 128x384x128 to the unet function. if not then why? I am using the unet 3d segmentation matlab built in function. tyoical inputs to that function is equal spaced dimentioons of 32, 64, 128, 256, and so on. can i input an image of size 128x384x128 to the unet function. if not then why? neural network, u net, image size MATLAB Answers — New Questions
How to join a clothoid and an circular arc for a smooth transition?
Hey,
I want to create a trajectory for a right turn driving scenario and have calculated x and y coordinates for a clothoid and a circular arc. I can not use Matlab toolboxes, which is why I used series development of sin and cos for the clothoid. As you can see in the picture, there is a change of curvature where I wanted to match up the clothoid and the arc (around x = 6.3 and y = -0.8).
How can I change my code, so there will be a smooth transition for the curvature? I also attached my code.
For the clothoid I used values given in the Euro NCAP Test Protocol from 2023. The clothoid should start with a radius of 1500 m and end with a radius of 8 m to match the radius of the circular arc. The angles are also given, see the picture below for more info.
Thank you so much!
JaneHey,
I want to create a trajectory for a right turn driving scenario and have calculated x and y coordinates for a clothoid and a circular arc. I can not use Matlab toolboxes, which is why I used series development of sin and cos for the clothoid. As you can see in the picture, there is a change of curvature where I wanted to match up the clothoid and the arc (around x = 6.3 and y = -0.8).
How can I change my code, so there will be a smooth transition for the curvature? I also attached my code.
For the clothoid I used values given in the Euro NCAP Test Protocol from 2023. The clothoid should start with a radius of 1500 m and end with a radius of 8 m to match the radius of the circular arc. The angles are also given, see the picture below for more info.
Thank you so much!
Jane Hey,
I want to create a trajectory for a right turn driving scenario and have calculated x and y coordinates for a clothoid and a circular arc. I can not use Matlab toolboxes, which is why I used series development of sin and cos for the clothoid. As you can see in the picture, there is a change of curvature where I wanted to match up the clothoid and the arc (around x = 6.3 and y = -0.8).
How can I change my code, so there will be a smooth transition for the curvature? I also attached my code.
For the clothoid I used values given in the Euro NCAP Test Protocol from 2023. The clothoid should start with a radius of 1500 m and end with a radius of 8 m to match the radius of the circular arc. The angles are also given, see the picture below for more info.
Thank you so much!
Jane clothoid, circular arc MATLAB Answers — New Questions
How to import multiple .mat files to workspace?
Hi,
As cited above, I’m trying to import multiple .mat files (total 72 no. of .mat files) which are at the location as in the code below. However the code doesn’t import the files to the workspace and throws error as below.
files = dir(‘D:RahulData_tokamakdata&plotdata_paper1H-mode dataH-mode bistable modelset1_neoAno_ratio_10beta0.01Contourplot*.mat’);
for i=1:length(files)
load(files(i).name,’-ascii’);
end
ERROR:
Error using load
with regards,
rcHi,
As cited above, I’m trying to import multiple .mat files (total 72 no. of .mat files) which are at the location as in the code below. However the code doesn’t import the files to the workspace and throws error as below.
files = dir(‘D:RahulData_tokamakdata&plotdata_paper1H-mode dataH-mode bistable modelset1_neoAno_ratio_10beta0.01Contourplot*.mat’);
for i=1:length(files)
load(files(i).name,’-ascii’);
end
ERROR:
Error using load
with regards,
rc Hi,
As cited above, I’m trying to import multiple .mat files (total 72 no. of .mat files) which are at the location as in the code below. However the code doesn’t import the files to the workspace and throws error as below.
files = dir(‘D:RahulData_tokamakdata&plotdata_paper1H-mode dataH-mode bistable modelset1_neoAno_ratio_10beta0.01Contourplot*.mat’);
for i=1:length(files)
load(files(i).name,’-ascii’);
end
ERROR:
Error using load
with regards,
rc data import MATLAB Answers — New Questions
Error with MATLAB function findcrossing “too many input arguments”
Ive been doing the MATLAB fundamentals code when I stumbled upon this error.
Initially the Code says:
y0 = 0;
yline(y0)
tzerox = findcrossing(t,x)
tzero
y = findcrossing(t,y)
TASK
Modify the definition of the findcrossing function so that it takes a third input z.
Add a new line to the beginning of the function:y = y – z;
In the Task 1 section of the script, change the value of y0 to 0.4.
Modify the two calls to findcrossing to add y0 as an input.
You can use the graph to check that the returned values of t are correct (x(t) = 0.4 and y(t) = 0.4)
I modified the code:
y0 = 0.4;
yline(y0)
tzerox = findcrossing(t,x,y0)
tzeroy = findcrossing(t,y,y0)
which is also the solution provided by MATLAB itself, but it says "Error using zerofunction>findcrossing. Too many input arguments".Ive been doing the MATLAB fundamentals code when I stumbled upon this error.
Initially the Code says:
y0 = 0;
yline(y0)
tzerox = findcrossing(t,x)
tzero
y = findcrossing(t,y)
TASK
Modify the definition of the findcrossing function so that it takes a third input z.
Add a new line to the beginning of the function:y = y – z;
In the Task 1 section of the script, change the value of y0 to 0.4.
Modify the two calls to findcrossing to add y0 as an input.
You can use the graph to check that the returned values of t are correct (x(t) = 0.4 and y(t) = 0.4)
I modified the code:
y0 = 0.4;
yline(y0)
tzerox = findcrossing(t,x,y0)
tzeroy = findcrossing(t,y,y0)
which is also the solution provided by MATLAB itself, but it says "Error using zerofunction>findcrossing. Too many input arguments". Ive been doing the MATLAB fundamentals code when I stumbled upon this error.
Initially the Code says:
y0 = 0;
yline(y0)
tzerox = findcrossing(t,x)
tzero
y = findcrossing(t,y)
TASK
Modify the definition of the findcrossing function so that it takes a third input z.
Add a new line to the beginning of the function:y = y – z;
In the Task 1 section of the script, change the value of y0 to 0.4.
Modify the two calls to findcrossing to add y0 as an input.
You can use the graph to check that the returned values of t are correct (x(t) = 0.4 and y(t) = 0.4)
I modified the code:
y0 = 0.4;
yline(y0)
tzerox = findcrossing(t,x,y0)
tzeroy = findcrossing(t,y,y0)
which is also the solution provided by MATLAB itself, but it says "Error using zerofunction>findcrossing. Too many input arguments". error, matlab function MATLAB Answers — New Questions
How do I make simulink model for self excited induction generator?
I have made a Simulink model for a grid connected induction generator by implementing the various voltage and torque equations of an induction generator in various blocks. I want to modify it to a self-excited induction generator by replacing the 3 phase source by a star/delta connected capacitor bank.But how can I provide the residual magnetism for the generator to start in this case?
I have attached the above stated file.I have made a Simulink model for a grid connected induction generator by implementing the various voltage and torque equations of an induction generator in various blocks. I want to modify it to a self-excited induction generator by replacing the 3 phase source by a star/delta connected capacitor bank.But how can I provide the residual magnetism for the generator to start in this case?
I have attached the above stated file. I have made a Simulink model for a grid connected induction generator by implementing the various voltage and torque equations of an induction generator in various blocks. I want to modify it to a self-excited induction generator by replacing the 3 phase source by a star/delta connected capacitor bank.But how can I provide the residual magnetism for the generator to start in this case?
I have attached the above stated file. induction generator, machine, self-excited induction generator MATLAB Answers — New Questions
Build failed happen when convert subsystem to model reference
I have 1 model with top level is a subsystem, i can success build it. But, when i converted that subsystem to a model reference, build failed happen with this information;
Error: Invalid data scope setting ‘File’ for data object ‘ABC’ when code is generated for model ‘ABC’. The data object is either used in more than one file in the generated code, has no readers or writers, or is a signal that is connected to a root input/output port. Modify the data scope of the data object to either ‘Auto’ or ‘Exported’.I have 1 model with top level is a subsystem, i can success build it. But, when i converted that subsystem to a model reference, build failed happen with this information;
Error: Invalid data scope setting ‘File’ for data object ‘ABC’ when code is generated for model ‘ABC’. The data object is either used in more than one file in the generated code, has no readers or writers, or is a signal that is connected to a root input/output port. Modify the data scope of the data object to either ‘Auto’ or ‘Exported’. I have 1 model with top level is a subsystem, i can success build it. But, when i converted that subsystem to a model reference, build failed happen with this information;
Error: Invalid data scope setting ‘File’ for data object ‘ABC’ when code is generated for model ‘ABC’. The data object is either used in more than one file in the generated code, has no readers or writers, or is a signal that is connected to a root input/output port. Modify the data scope of the data object to either ‘Auto’ or ‘Exported’. simulink, subsystem, model reference, convert MATLAB Answers — New Questions
how to plot contour for arbitrary shape (not rectangular) in matlab?
Hello guys, I have a question for you
In relation to drawing the contour of a non-rectangular shape, what method should be adopted?
For example, how can you draw the contour of the following figure?
If our data is the coordinates of each point (x,y) and the value of Z at each point.
Thank you all.Hello guys, I have a question for you
In relation to drawing the contour of a non-rectangular shape, what method should be adopted?
For example, how can you draw the contour of the following figure?
If our data is the coordinates of each point (x,y) and the value of Z at each point.
Thank you all. Hello guys, I have a question for you
In relation to drawing the contour of a non-rectangular shape, what method should be adopted?
For example, how can you draw the contour of the following figure?
If our data is the coordinates of each point (x,y) and the value of Z at each point.
Thank you all. matlab, contour, plot MATLAB Answers — New Questions
How to find the point that resides on a contour that is closest to a known point?
I got this from another post of mine.
Z = peaks(50)/10;
level = 0.04;
surf(Z)
hold on
% extract all isocline for a given level
[C,h] = contour(Z,level*[1 1]);
[m,n] = size(C);
ind = find(C(1,:)==level); % index of beginning of each isocline data in C
ind = [ind n+1]; % add end (+1)
for k = 1:numel(ind)-1
xc = C(1,ind(k)+1:ind(k+1)-1);
yc = C(2,ind(k)+1:ind(k+1)-1);
zc = level*ones(size(xc));
plot3(xc,yc,zc,’linewidth’,5);
end
hold off
Now, suppose I know a point (16,35,0.05). I want to find the closest point on a contour whose height is zc = 0.056.
How do I do that? What sort of minimization problem needes to be solved? And how do I replicate the usual minimization that we use in differential calculus like dy/dx =0?I got this from another post of mine.
Z = peaks(50)/10;
level = 0.04;
surf(Z)
hold on
% extract all isocline for a given level
[C,h] = contour(Z,level*[1 1]);
[m,n] = size(C);
ind = find(C(1,:)==level); % index of beginning of each isocline data in C
ind = [ind n+1]; % add end (+1)
for k = 1:numel(ind)-1
xc = C(1,ind(k)+1:ind(k+1)-1);
yc = C(2,ind(k)+1:ind(k+1)-1);
zc = level*ones(size(xc));
plot3(xc,yc,zc,’linewidth’,5);
end
hold off
Now, suppose I know a point (16,35,0.05). I want to find the closest point on a contour whose height is zc = 0.056.
How do I do that? What sort of minimization problem needes to be solved? And how do I replicate the usual minimization that we use in differential calculus like dy/dx =0? I got this from another post of mine.
Z = peaks(50)/10;
level = 0.04;
surf(Z)
hold on
% extract all isocline for a given level
[C,h] = contour(Z,level*[1 1]);
[m,n] = size(C);
ind = find(C(1,:)==level); % index of beginning of each isocline data in C
ind = [ind n+1]; % add end (+1)
for k = 1:numel(ind)-1
xc = C(1,ind(k)+1:ind(k+1)-1);
yc = C(2,ind(k)+1:ind(k+1)-1);
zc = level*ones(size(xc));
plot3(xc,yc,zc,’linewidth’,5);
end
hold off
Now, suppose I know a point (16,35,0.05). I want to find the closest point on a contour whose height is zc = 0.056.
How do I do that? What sort of minimization problem needes to be solved? And how do I replicate the usual minimization that we use in differential calculus like dy/dx =0? matlab MATLAB Answers — New Questions
How can I restore a previous version of an m-file that I have accidentally overwritten with a MAT-file ?
How can I restore a previous version of an m-file that I have accidentally overwritten with a MAT-file (I guess with the command "save") ?
Now it it is unreadable and with stange symbols, and it looks like this:
MATLAB 5.0 MAT-file, Platform: MACI64, Created on: Fri Aug 30 19:21:09 2019 ����������IM����»e��xœìÊÇ
�1�€á¸�l¨ Ø�‚½‹ØÅŠ
V�ÛÕ÷
#x“5ºIfÍnæcø���Bè�u!�®�ï³Ï±¿nÏJA
®�[âÚðVð¿E8
�+�§*�sn
<ª¼šø4ð� �ü D)ÌUD’Q‚�…8A‚BR�FŠ«4…�’YÎr�yÃ+�(�(™J�T�D�@:QC0MIU�TÛä:?éþ��}I“�†�3#îÆ‚šH:˜‚š˜3²øÂ’‘�°µl¾°%ÚIØ^X�S9R;Q;ÿ™‹a]¥77Óz���ÿÿìÂW
Â@��P�{E�E,ˆ‚ bï]¬`ùP�Á+z�“ ›Ùq“�ïi�
‰×�à’�@��„�„]’Â�±(º˜�ÅA )’JI¹@šX�EVXN�y‹
€" dA™!¨ ¨‚jdê6Ò`Hš6Ò"ÓVDÇ!ºdz€¾
�@CЈý0fŠ˜üÕÔÐLª¹Â�µ�°’`-h£Œ ‚öŽuÐud&tu]�å
ºî�=H<A/Л1)>&}���ÿÿìÂ?/ÃA��`]´ƒˆ¡›Ä"Æ&Š�è`l¨7 5(ªÒ�W¤CEHow can I restore a previous version of an m-file that I have accidentally overwritten with a MAT-file (I guess with the command "save") ?
Now it it is unreadable and with stange symbols, and it looks like this:
MATLAB 5.0 MAT-file, Platform: MACI64, Created on: Fri Aug 30 19:21:09 2019 ����������IM����»e��xœìÊÇ
�1�€á¸�l¨ Ø�‚½‹ØÅŠ
V�ÛÕ÷
#x“5ºIfÍnæcø���Bè�u!�®�ï³Ï±¿nÏJA
®�[âÚðVð¿E8
�+�§*�sn
<ª¼šø4ð� �ü D)ÌUD’Q‚�…8A‚BR�FŠ«4…�’YÎr�yÃ+�(�(™J�T�D�@:QC0MIU�TÛä:?éþ��}I“�†�3#îÆ‚šH:˜‚š˜3²øÂ’‘�°µl¾°%ÚIØ^X�S9R;Q;ÿ™‹a]¥77Óz���ÿÿìÂW
Â@��P�{E�E,ˆ‚ bï]¬`ùP�Á+z�“ ›Ùq“�ïi�
‰×�à’�@��„�„]’Â�±(º˜�ÅA )’JI¹@šX�EVXN�y‹
€" dA™!¨ ¨‚jdê6Ò`Hš6Ò"ÓVDÇ!ºdz€¾
�@CЈý0fŠ˜üÕÔÐLª¹Â�µ�°’`-h£Œ ‚öŽuÐud&tu]�å
ºî�=H<A/Л1)>&}���ÿÿìÂ?/ÃA��`]´ƒˆ¡›Ä"Æ&Š�è`l¨7 5(ªÒ�W¤CE How can I restore a previous version of an m-file that I have accidentally overwritten with a MAT-file (I guess with the command "save") ?
Now it it is unreadable and with stange symbols, and it looks like this:
MATLAB 5.0 MAT-file, Platform: MACI64, Created on: Fri Aug 30 19:21:09 2019 ����������IM����»e��xœìÊÇ
�1�€á¸�l¨ Ø�‚½‹ØÅŠ
V�ÛÕ÷
#x“5ºIfÍnæcø���Bè�u!�®�ï³Ï±¿nÏJA
®�[âÚðVð¿E8
�+�§*�sn
<ª¼šø4ð� �ü D)ÌUD’Q‚�…8A‚BR�FŠ«4…�’YÎr�yÃ+�(�(™J�T�D�@:QC0MIU�TÛä:?éþ��}I“�†�3#îÆ‚šH:˜‚š˜3²øÂ’‘�°µl¾°%ÚIØ^X�S9R;Q;ÿ™‹a]¥77Óz���ÿÿìÂW
Â@��P�{E�E,ˆ‚ bï]¬`ùP�Á+z�“ ›Ùq“�ïi�
‰×�à’�@��„�„]’Â�±(º˜�ÅA )’JI¹@šX�EVXN�y‹
€" dA™!¨ ¨‚jdê6Ò`Hš6Ò"ÓVDÇ!ºdz€¾
�@CЈý0fŠ˜üÕÔÐLª¹Â�µ�°’`-h£Œ ‚öŽuÐud&tu]�å
ºî�=H<A/Л1)>&}���ÿÿìÂ?/ÃA��`]´ƒˆ¡›Ä"Æ&Š�è`l¨7 5(ªÒ�W¤CE overwritten m-file MATLAB Answers — New Questions
A naive question regarding MATLABs definition of parabolic/elliptical PDEs (pdepe)
This is a shortly put question, and possibly very obvious, but MATLAB says in the documentation of pdepe (here) that is solves 1D parabolic and elliptical PDEs. However, any definition I’ve come across for PDEs’ conic classification holds that the coefficients in the PDE expansion should be constant, i.e.
where
For pdepe these coefficients are functions however. How does MATLAB classify them as parabolic or elliptical if the coefficients are variable? Is it that it must follow the inequality below?This is a shortly put question, and possibly very obvious, but MATLAB says in the documentation of pdepe (here) that is solves 1D parabolic and elliptical PDEs. However, any definition I’ve come across for PDEs’ conic classification holds that the coefficients in the PDE expansion should be constant, i.e.
where
For pdepe these coefficients are functions however. How does MATLAB classify them as parabolic or elliptical if the coefficients are variable? Is it that it must follow the inequality below? This is a shortly put question, and possibly very obvious, but MATLAB says in the documentation of pdepe (here) that is solves 1D parabolic and elliptical PDEs. However, any definition I’ve come across for PDEs’ conic classification holds that the coefficients in the PDE expansion should be constant, i.e.
where
For pdepe these coefficients are functions however. How does MATLAB classify them as parabolic or elliptical if the coefficients are variable? Is it that it must follow the inequality below? mathematics MATLAB Answers — New Questions
How do I plot the point SOR solution along the vertical central line x=0.5 and compare it with the analytical solution?
The analytical solution is U(x,y) = sin(pi*x)cosh(pi*y)/(pi*sin(pi)).
% …… code
% calculate improved estimate using the SOR method
unew = u;
for j = 2 : Ny + 1
for i = 2 : Nx – 1
% POINT SOR METHOD
unew(j, i) = (1-w)*(u(j, i)) + w * ((dy^2)*(unew(j, i-1) + u(j, i+1)) + (dx^2)*(unew(j-1, i) + u(j+1, i))) / (2*(dy^2+dx^2));
end
end
% Calculate L2 error between two successive steps
err = sqrt(sum(sum((unew – u).^2)));
% Update U and iteration count
u = unew;
k = k + 1;
% output current solution
fprintf(‘ %4i ‘, k);
fprintf(‘|%10.6f ‘, u(2:Ny+1, 2:Nx-1)’);
fprintf(‘|%10.6f n’, err);
end
% Ensure SOR solution is stored in the array u
SOR_solution = u;
fprintf(‘%sn’, hline)
cpu_time = toc;
fprintf(‘nCPU time for this method is %1.4f s.n’, cpu_time)
% Analytical solution
u_analytical = @(x, y) sin(pi*x).*cosh(pi*y)./(pi*sinh(pi));
% Plot SOR solution along the vertical central line x=0.5
x_index = find(x(1, 🙂 == 0.5);
figure; % Create a new figure
hold on; % Enable overlaying plots
plot(y(:, x_index), u(:, x_index), ‘b’, ‘DisplayName’, ‘SOR Solution’);
plot(y(:, x_index), u_analytical(0.5, y(:, x_index)), ‘r’, ‘DisplayName’, ‘Analytical Solution’);
xlabel(‘y’);
ylabel(‘U(x,y)’);
legend(‘Location’, ‘best’);
title(‘Comparison of SOR Solution and Analytical Solution at x = 0.5 (w = 1.85)’);
grid on;
hold off; % Release the overlaying plot modeThe analytical solution is U(x,y) = sin(pi*x)cosh(pi*y)/(pi*sin(pi)).
% …… code
% calculate improved estimate using the SOR method
unew = u;
for j = 2 : Ny + 1
for i = 2 : Nx – 1
% POINT SOR METHOD
unew(j, i) = (1-w)*(u(j, i)) + w * ((dy^2)*(unew(j, i-1) + u(j, i+1)) + (dx^2)*(unew(j-1, i) + u(j+1, i))) / (2*(dy^2+dx^2));
end
end
% Calculate L2 error between two successive steps
err = sqrt(sum(sum((unew – u).^2)));
% Update U and iteration count
u = unew;
k = k + 1;
% output current solution
fprintf(‘ %4i ‘, k);
fprintf(‘|%10.6f ‘, u(2:Ny+1, 2:Nx-1)’);
fprintf(‘|%10.6f n’, err);
end
% Ensure SOR solution is stored in the array u
SOR_solution = u;
fprintf(‘%sn’, hline)
cpu_time = toc;
fprintf(‘nCPU time for this method is %1.4f s.n’, cpu_time)
% Analytical solution
u_analytical = @(x, y) sin(pi*x).*cosh(pi*y)./(pi*sinh(pi));
% Plot SOR solution along the vertical central line x=0.5
x_index = find(x(1, 🙂 == 0.5);
figure; % Create a new figure
hold on; % Enable overlaying plots
plot(y(:, x_index), u(:, x_index), ‘b’, ‘DisplayName’, ‘SOR Solution’);
plot(y(:, x_index), u_analytical(0.5, y(:, x_index)), ‘r’, ‘DisplayName’, ‘Analytical Solution’);
xlabel(‘y’);
ylabel(‘U(x,y)’);
legend(‘Location’, ‘best’);
title(‘Comparison of SOR Solution and Analytical Solution at x = 0.5 (w = 1.85)’);
grid on;
hold off; % Release the overlaying plot mode The analytical solution is U(x,y) = sin(pi*x)cosh(pi*y)/(pi*sin(pi)).
% …… code
% calculate improved estimate using the SOR method
unew = u;
for j = 2 : Ny + 1
for i = 2 : Nx – 1
% POINT SOR METHOD
unew(j, i) = (1-w)*(u(j, i)) + w * ((dy^2)*(unew(j, i-1) + u(j, i+1)) + (dx^2)*(unew(j-1, i) + u(j+1, i))) / (2*(dy^2+dx^2));
end
end
% Calculate L2 error between two successive steps
err = sqrt(sum(sum((unew – u).^2)));
% Update U and iteration count
u = unew;
k = k + 1;
% output current solution
fprintf(‘ %4i ‘, k);
fprintf(‘|%10.6f ‘, u(2:Ny+1, 2:Nx-1)’);
fprintf(‘|%10.6f n’, err);
end
% Ensure SOR solution is stored in the array u
SOR_solution = u;
fprintf(‘%sn’, hline)
cpu_time = toc;
fprintf(‘nCPU time for this method is %1.4f s.n’, cpu_time)
% Analytical solution
u_analytical = @(x, y) sin(pi*x).*cosh(pi*y)./(pi*sinh(pi));
% Plot SOR solution along the vertical central line x=0.5
x_index = find(x(1, 🙂 == 0.5);
figure; % Create a new figure
hold on; % Enable overlaying plots
plot(y(:, x_index), u(:, x_index), ‘b’, ‘DisplayName’, ‘SOR Solution’);
plot(y(:, x_index), u_analytical(0.5, y(:, x_index)), ‘r’, ‘DisplayName’, ‘Analytical Solution’);
xlabel(‘y’);
ylabel(‘U(x,y)’);
legend(‘Location’, ‘best’);
title(‘Comparison of SOR Solution and Analytical Solution at x = 0.5 (w = 1.85)’);
grid on;
hold off; % Release the overlaying plot mode plot numerical solution with analytical solution. MATLAB Answers — New Questions
An external program (.exe) started with “system” terminates early
I have a console application that computes a complicated function and outputs a text file with a resulting value. This application runs for about 8 minutes. I run it repeatedly with system("my.exe") within a surrogateopt function. The problem is that this .exe when started from MATLAB terminates early sometimes as if the process was destroyed (it can happen on first or on 25th iteration, no pattern noticed). When I run the application manually with current surrogateopt parameters, it runs completely fine.
I tried to disable antivirus, but it didn’t help, so I guess, it might be an internal MATLAB problem.
Are there any known problems of that kind or any ideas why this might happen?I have a console application that computes a complicated function and outputs a text file with a resulting value. This application runs for about 8 minutes. I run it repeatedly with system("my.exe") within a surrogateopt function. The problem is that this .exe when started from MATLAB terminates early sometimes as if the process was destroyed (it can happen on first or on 25th iteration, no pattern noticed). When I run the application manually with current surrogateopt parameters, it runs completely fine.
I tried to disable antivirus, but it didn’t help, so I guess, it might be an internal MATLAB problem.
Are there any known problems of that kind or any ideas why this might happen? I have a console application that computes a complicated function and outputs a text file with a resulting value. This application runs for about 8 minutes. I run it repeatedly with system("my.exe") within a surrogateopt function. The problem is that this .exe when started from MATLAB terminates early sometimes as if the process was destroyed (it can happen on first or on 25th iteration, no pattern noticed). When I run the application manually with current surrogateopt parameters, it runs completely fine.
I tried to disable antivirus, but it didn’t help, so I guess, it might be an internal MATLAB problem.
Are there any known problems of that kind or any ideas why this might happen? system, exe, windows MATLAB Answers — New Questions
Running a compiled .exe file per VBA Excel produces an error
Hello everyone,
I do NOT have Matlab installed on my computer, only the Matlab Runtime version MATLAB_Runtime_R2024a_win64.
When I start my compiled .exe file by double clicking in Windows, it works flawlessly.
When I try to run the same .exe file from Excel with a VBA script, I see that the cmd screen opens but closes after a while after getting the following error:
Array indices must be positive integers or logical values.
Error in matlabfilecompiledfile_24a.exe (line 602)
Matlab: just subscript
I can’t figure out why this is happening
My VBA script in Excel is as follows:
Subtest()
Dim run file
runfile = Shell("File pathmatlabfilecompiledfile_24a.exe", vbNormalFocus)
End sub
Can anyone help me with a working script so I can run the file from Excel via VBA?
Thank you in advance.Hello everyone,
I do NOT have Matlab installed on my computer, only the Matlab Runtime version MATLAB_Runtime_R2024a_win64.
When I start my compiled .exe file by double clicking in Windows, it works flawlessly.
When I try to run the same .exe file from Excel with a VBA script, I see that the cmd screen opens but closes after a while after getting the following error:
Array indices must be positive integers or logical values.
Error in matlabfilecompiledfile_24a.exe (line 602)
Matlab: just subscript
I can’t figure out why this is happening
My VBA script in Excel is as follows:
Subtest()
Dim run file
runfile = Shell("File pathmatlabfilecompiledfile_24a.exe", vbNormalFocus)
End sub
Can anyone help me with a working script so I can run the file from Excel via VBA?
Thank you in advance. Hello everyone,
I do NOT have Matlab installed on my computer, only the Matlab Runtime version MATLAB_Runtime_R2024a_win64.
When I start my compiled .exe file by double clicking in Windows, it works flawlessly.
When I try to run the same .exe file from Excel with a VBA script, I see that the cmd screen opens but closes after a while after getting the following error:
Array indices must be positive integers or logical values.
Error in matlabfilecompiledfile_24a.exe (line 602)
Matlab: just subscript
I can’t figure out why this is happening
My VBA script in Excel is as follows:
Subtest()
Dim run file
runfile = Shell("File pathmatlabfilecompiledfile_24a.exe", vbNormalFocus)
End sub
Can anyone help me with a working script so I can run the file from Excel via VBA?
Thank you in advance. vba exe MATLAB Answers — New Questions
Does Matlabappdesigner support webmaps?
Does Matlabappdesigner support webmaps?
I have a shp file that renders very well with wmmarker and can be queried. How can I embed this module into appdesigner?
Matlab version 2023aDoes Matlabappdesigner support webmaps?
I have a shp file that renders very well with wmmarker and can be queried. How can I embed this module into appdesigner?
Matlab version 2023a Does Matlabappdesigner support webmaps?
I have a shp file that renders very well with wmmarker and can be queried. How can I embed this module into appdesigner?
Matlab version 2023a wmmarker, appdesigner, readgeotable MATLAB Answers — New Questions
remove inf in quiver
I want quiver(X,Y,u,v), but there’s inf entries in u and v at positions x=y. I’m looking for the smartest way to skip these positions with inf u and v and finish the quiver.
x=-5:0.1:5;
y=-5:0.1:5;
[X,Y]=meshgrid(x,y);I want quiver(X,Y,u,v), but there’s inf entries in u and v at positions x=y. I’m looking for the smartest way to skip these positions with inf u and v and finish the quiver.
x=-5:0.1:5;
y=-5:0.1:5;
[X,Y]=meshgrid(x,y); I want quiver(X,Y,u,v), but there’s inf entries in u and v at positions x=y. I’m looking for the smartest way to skip these positions with inf u and v and finish the quiver.
x=-5:0.1:5;
y=-5:0.1:5;
[X,Y]=meshgrid(x,y); quiver MATLAB Answers — New Questions