Category: Matlab
Category Archives: Matlab
copping grayscale image and remove any other borders or details
could you please help me to get only the gray scale images without any borders and without any written words or letters created by the device . i want a general code to do this beause i have other images with other border thickness and other written , and i want the gray image entire only
@Image Analyst
Image Analystcould you please help me to get only the gray scale images without any borders and without any written words or letters created by the device . i want a general code to do this beause i have other images with other border thickness and other written , and i want the gray image entire only
@Image Analyst
Image Analyst could you please help me to get only the gray scale images without any borders and without any written words or letters created by the device . i want a general code to do this beause i have other images with other border thickness and other written , and i want the gray image entire only
@Image Analyst
Image Analyst image analyst MATLAB Answers — New Questions
Design a feedback controller to control pH value of a non linear system
Hi all!.
I am working on a question where we calculate an optimal dosage using multiple sensor inputs. Then we send the calculated dosage to the plant and we monitor the pH value. Right now we have an open loop system. I want to maintain the output pH value in a range of 5.2 to 5.8 by introducing a feedback and a PID controller.
I have previous data about the dosage we calculated and the resulted pH values.Hi all!.
I am working on a question where we calculate an optimal dosage using multiple sensor inputs. Then we send the calculated dosage to the plant and we monitor the pH value. Right now we have an open loop system. I want to maintain the output pH value in a range of 5.2 to 5.8 by introducing a feedback and a PID controller.
I have previous data about the dosage we calculated and the resulted pH values. Hi all!.
I am working on a question where we calculate an optimal dosage using multiple sensor inputs. Then we send the calculated dosage to the plant and we monitor the pH value. Right now we have an open loop system. I want to maintain the output pH value in a range of 5.2 to 5.8 by introducing a feedback and a PID controller.
I have previous data about the dosage we calculated and the resulted pH values. pid, ph, feedback control MATLAB Answers — New Questions
wt is the Activation Key for activating MATLAB Simulink
Activation KeyActivation Key Activation Key provide activation key for matlab MATLAB Answers — New Questions
vgg16 not installed as Deep learning toolbox has missing this package
Error using vgg16 (line 60)
vgg16 requires the Deep Learning Toolbox Model for VGG-16 Network support package. To install this support package, use the Add-On Explorer.
How can we run the program without package installed? Is there any solution?Error using vgg16 (line 60)
vgg16 requires the Deep Learning Toolbox Model for VGG-16 Network support package. To install this support package, use the Add-On Explorer.
How can we run the program without package installed? Is there any solution? Error using vgg16 (line 60)
vgg16 requires the Deep Learning Toolbox Model for VGG-16 Network support package. To install this support package, use the Add-On Explorer.
How can we run the program without package installed? Is there any solution? neural network model, vgg16 MATLAB Answers — New Questions
Using FFT Coefficients/Descriptors to reconstruct particle shape
Hi, I am trying to use Fourier descriptors to reconstruct the shape of a particle. I have written most of the code (with a lot of help) and only the last step which involves using Fourier descriptors to reconstruct the shape of the original image remains.
I need help to know which functions to use to achieve this. I would really appreciate if anyone could help.
Here is the code:
I have also attached the original image and another file which demonstrates what I need to do.
scale_factor = 100/90; % (units: microns/pixel)
% to convert pixels to microns,
% multiply # of pixels by scale_factor
%1. Open and show image of particle
img = imread(‘1_50.JPG’); %Read image
subplot (3,3,1)
imshow(img) %show image
%2. Binarize and show image
BW = im2bw(img,0.45); %binarize image with a threshold value of 0.45
img1= bwareaopen (BW, 1000); %Remove small objects
img2= imfill(img1, ‘holes’); %fill holes
subplot(3,3,2)
imshow(img2) %show binarized image
%3. Setting up the axes
% for plotting into multiple axes in one loop, it’s convenient to set up
% all the axes first, before anything is plotted into them
% 3.1. set up the 2nd axes:
ax3 = subplot(3,3,3);
hold on
box on %draws a box that encompasses the entire axes area
axis image %sets the aspect ratio of the axes (ax2) to be equal and
%adjusts the limits of the axes so that the data units are
%of equal size along both the x-axis and y-axis.
set(ax3,’YDir’,’reverse’) %reverses the y-axis to begin from the top
%since the origin of the image is at the top left-corner
% 3.2. set up the 3rd axes:
ax4 = subplot(3,3,4);
hold on
%4. Compute centroid of binarized image
centriod_value= regionprops(img2, ‘Centroid’); %Finds centroid of image
centroid = cat(1,centriod_value.Centroid); %Stores centroid coordinates in a two-column matrix
%5. Tracing the boundary of image
p_boundary= bwboundaries(img2); % trace the exterior boundaries of particle
%(in row, column order, not x,y)
number_of_boundaries = size(p_boundary,1); %specify only one boundary
centroid = centroid*scale_factor;
% 6. Setting up equally spaced angles before initing the loop
%use 129 points to have an angle spacing of 360/128
N_angles = 129;
interp_angles = linspace(0,360,N_angles).’;
%7. Initiate for loop to plot boundary, centroid, & a graph of radius vs angle
for k = 1 : number_of_boundaries % initiate loop to go round the selected boundary
thisBoundary = p_boundary{k}*scale_factor;
y = thisBoundary(:,1); % rows
x = thisBoundary(:,2); % columns
plot(ax3, x, y, ‘g’, ‘LineWidth’, 2);
plot(ax3, centroid(:,1),centroid(:,2),’b.’)
% 7.1. Calculate the angles in degrees
deltaY = thisBoundary(:,1) – centroid(k,2); % boundary(:,1) is y, but centroid(k,2) is y
deltaX = thisBoundary(:,2) – centroid(k,1); % boundary(:,2) is x, but centroid(k,1) is x
% angles = atand(deltaY ./ deltaX); % atand gives angles in range [-90,90]
angles = atan2d(deltaY,deltaX); % use atan2d to get angles in range [-180,180]
% 7.2. Calculate the radii
radius = sqrt(deltaY.^2 + deltaX.^2); % use deltaX and deltaY, which were just calculated
% 7.3. Add 360 degrees to negative angles so that range is [0,360] instead of [-180,180]
idx = angles < 0; %idx reps angles less than 0 degreees
angles(idx) = angles(idx)+360; %360 degrees is added to idx angles
%7.4. Sort angles in ascending order
% sort the angles, so the first one is smallest (closest to zero)
% and the last one is largest (closest to 360)
% this is useful for getting a smooth line that goes from 0 to 360 in the plot
% I returns the corresponding indices of the angles
[angles,I] = sort(angles);
%7.5. Reorder distances the same way angles was reordered using I
radius = radius(I);
%7.6. Use only unique angles in case an angle is repeated
% in case any angles are repeated, use only the unique set and
% corresponding distances in interp1 (in this data, one angle is
% repeated twice, with the same distance each time)
%The ~ (tilde) here is a placeholder indicating that we’re not interested
%in capturing the actual unique elements, only their indices
[~,I] = unique(angles);
% 7.7. perform linear interpolation/extrapolation:
%angles(I)= sample points, radius(I)= correspoinding points
%and interp_angles = coordinates of the querry points (QP)
%In general, the functions returns interpolated values at specific QP
interp_distances = interp1(angles(I),radius(I),interp_angles,’linear’,’extrap’);
% 7.8 Plot distance vs. angle.
plot(ax4,interp_angles,interp_distances)
end
%8. Apply fft algorithm to values of radius
L = length(interp_distances); %Define the number of the radiuses (points)
f = 0:L-1; %Define the sampling frequencies
A = fft(interp_distances); %Transforming the radius function into frequency domain using FFT
B = (abs(A)/2535.2); % Normalize the amplitude of fourier descriptors using the first descriptors
%9. Plot fft descriptor vs. frequency
subplot(3,3,5)
bar(f,B,3) %plot the frequencies vs. the nornalised descriptors
xlim([0 128])
%10. Plot phase angle vs. frequency
subplot(3,3,6)
bar(f, angle(A),3) % plot the frequencies vs phase angles
xlim([0 128])
ylim([-4 4])
%11. Create a table of values
table1 = table(A, f’, abs(A), B, angle(A));
table1.Properties.VariableNames = {‘FFT_coeffs’, ‘Frequency’, ‘Amplitude’, ‘Norm_Amplitude’ ‘Phase’};
disp(table1);
%12. Reconstruct particle boundary using FFT descriptors ?????Hi, I am trying to use Fourier descriptors to reconstruct the shape of a particle. I have written most of the code (with a lot of help) and only the last step which involves using Fourier descriptors to reconstruct the shape of the original image remains.
I need help to know which functions to use to achieve this. I would really appreciate if anyone could help.
Here is the code:
I have also attached the original image and another file which demonstrates what I need to do.
scale_factor = 100/90; % (units: microns/pixel)
% to convert pixels to microns,
% multiply # of pixels by scale_factor
%1. Open and show image of particle
img = imread(‘1_50.JPG’); %Read image
subplot (3,3,1)
imshow(img) %show image
%2. Binarize and show image
BW = im2bw(img,0.45); %binarize image with a threshold value of 0.45
img1= bwareaopen (BW, 1000); %Remove small objects
img2= imfill(img1, ‘holes’); %fill holes
subplot(3,3,2)
imshow(img2) %show binarized image
%3. Setting up the axes
% for plotting into multiple axes in one loop, it’s convenient to set up
% all the axes first, before anything is plotted into them
% 3.1. set up the 2nd axes:
ax3 = subplot(3,3,3);
hold on
box on %draws a box that encompasses the entire axes area
axis image %sets the aspect ratio of the axes (ax2) to be equal and
%adjusts the limits of the axes so that the data units are
%of equal size along both the x-axis and y-axis.
set(ax3,’YDir’,’reverse’) %reverses the y-axis to begin from the top
%since the origin of the image is at the top left-corner
% 3.2. set up the 3rd axes:
ax4 = subplot(3,3,4);
hold on
%4. Compute centroid of binarized image
centriod_value= regionprops(img2, ‘Centroid’); %Finds centroid of image
centroid = cat(1,centriod_value.Centroid); %Stores centroid coordinates in a two-column matrix
%5. Tracing the boundary of image
p_boundary= bwboundaries(img2); % trace the exterior boundaries of particle
%(in row, column order, not x,y)
number_of_boundaries = size(p_boundary,1); %specify only one boundary
centroid = centroid*scale_factor;
% 6. Setting up equally spaced angles before initing the loop
%use 129 points to have an angle spacing of 360/128
N_angles = 129;
interp_angles = linspace(0,360,N_angles).’;
%7. Initiate for loop to plot boundary, centroid, & a graph of radius vs angle
for k = 1 : number_of_boundaries % initiate loop to go round the selected boundary
thisBoundary = p_boundary{k}*scale_factor;
y = thisBoundary(:,1); % rows
x = thisBoundary(:,2); % columns
plot(ax3, x, y, ‘g’, ‘LineWidth’, 2);
plot(ax3, centroid(:,1),centroid(:,2),’b.’)
% 7.1. Calculate the angles in degrees
deltaY = thisBoundary(:,1) – centroid(k,2); % boundary(:,1) is y, but centroid(k,2) is y
deltaX = thisBoundary(:,2) – centroid(k,1); % boundary(:,2) is x, but centroid(k,1) is x
% angles = atand(deltaY ./ deltaX); % atand gives angles in range [-90,90]
angles = atan2d(deltaY,deltaX); % use atan2d to get angles in range [-180,180]
% 7.2. Calculate the radii
radius = sqrt(deltaY.^2 + deltaX.^2); % use deltaX and deltaY, which were just calculated
% 7.3. Add 360 degrees to negative angles so that range is [0,360] instead of [-180,180]
idx = angles < 0; %idx reps angles less than 0 degreees
angles(idx) = angles(idx)+360; %360 degrees is added to idx angles
%7.4. Sort angles in ascending order
% sort the angles, so the first one is smallest (closest to zero)
% and the last one is largest (closest to 360)
% this is useful for getting a smooth line that goes from 0 to 360 in the plot
% I returns the corresponding indices of the angles
[angles,I] = sort(angles);
%7.5. Reorder distances the same way angles was reordered using I
radius = radius(I);
%7.6. Use only unique angles in case an angle is repeated
% in case any angles are repeated, use only the unique set and
% corresponding distances in interp1 (in this data, one angle is
% repeated twice, with the same distance each time)
%The ~ (tilde) here is a placeholder indicating that we’re not interested
%in capturing the actual unique elements, only their indices
[~,I] = unique(angles);
% 7.7. perform linear interpolation/extrapolation:
%angles(I)= sample points, radius(I)= correspoinding points
%and interp_angles = coordinates of the querry points (QP)
%In general, the functions returns interpolated values at specific QP
interp_distances = interp1(angles(I),radius(I),interp_angles,’linear’,’extrap’);
% 7.8 Plot distance vs. angle.
plot(ax4,interp_angles,interp_distances)
end
%8. Apply fft algorithm to values of radius
L = length(interp_distances); %Define the number of the radiuses (points)
f = 0:L-1; %Define the sampling frequencies
A = fft(interp_distances); %Transforming the radius function into frequency domain using FFT
B = (abs(A)/2535.2); % Normalize the amplitude of fourier descriptors using the first descriptors
%9. Plot fft descriptor vs. frequency
subplot(3,3,5)
bar(f,B,3) %plot the frequencies vs. the nornalised descriptors
xlim([0 128])
%10. Plot phase angle vs. frequency
subplot(3,3,6)
bar(f, angle(A),3) % plot the frequencies vs phase angles
xlim([0 128])
ylim([-4 4])
%11. Create a table of values
table1 = table(A, f’, abs(A), B, angle(A));
table1.Properties.VariableNames = {‘FFT_coeffs’, ‘Frequency’, ‘Amplitude’, ‘Norm_Amplitude’ ‘Phase’};
disp(table1);
%12. Reconstruct particle boundary using FFT descriptors ????? Hi, I am trying to use Fourier descriptors to reconstruct the shape of a particle. I have written most of the code (with a lot of help) and only the last step which involves using Fourier descriptors to reconstruct the shape of the original image remains.
I need help to know which functions to use to achieve this. I would really appreciate if anyone could help.
Here is the code:
I have also attached the original image and another file which demonstrates what I need to do.
scale_factor = 100/90; % (units: microns/pixel)
% to convert pixels to microns,
% multiply # of pixels by scale_factor
%1. Open and show image of particle
img = imread(‘1_50.JPG’); %Read image
subplot (3,3,1)
imshow(img) %show image
%2. Binarize and show image
BW = im2bw(img,0.45); %binarize image with a threshold value of 0.45
img1= bwareaopen (BW, 1000); %Remove small objects
img2= imfill(img1, ‘holes’); %fill holes
subplot(3,3,2)
imshow(img2) %show binarized image
%3. Setting up the axes
% for plotting into multiple axes in one loop, it’s convenient to set up
% all the axes first, before anything is plotted into them
% 3.1. set up the 2nd axes:
ax3 = subplot(3,3,3);
hold on
box on %draws a box that encompasses the entire axes area
axis image %sets the aspect ratio of the axes (ax2) to be equal and
%adjusts the limits of the axes so that the data units are
%of equal size along both the x-axis and y-axis.
set(ax3,’YDir’,’reverse’) %reverses the y-axis to begin from the top
%since the origin of the image is at the top left-corner
% 3.2. set up the 3rd axes:
ax4 = subplot(3,3,4);
hold on
%4. Compute centroid of binarized image
centriod_value= regionprops(img2, ‘Centroid’); %Finds centroid of image
centroid = cat(1,centriod_value.Centroid); %Stores centroid coordinates in a two-column matrix
%5. Tracing the boundary of image
p_boundary= bwboundaries(img2); % trace the exterior boundaries of particle
%(in row, column order, not x,y)
number_of_boundaries = size(p_boundary,1); %specify only one boundary
centroid = centroid*scale_factor;
% 6. Setting up equally spaced angles before initing the loop
%use 129 points to have an angle spacing of 360/128
N_angles = 129;
interp_angles = linspace(0,360,N_angles).’;
%7. Initiate for loop to plot boundary, centroid, & a graph of radius vs angle
for k = 1 : number_of_boundaries % initiate loop to go round the selected boundary
thisBoundary = p_boundary{k}*scale_factor;
y = thisBoundary(:,1); % rows
x = thisBoundary(:,2); % columns
plot(ax3, x, y, ‘g’, ‘LineWidth’, 2);
plot(ax3, centroid(:,1),centroid(:,2),’b.’)
% 7.1. Calculate the angles in degrees
deltaY = thisBoundary(:,1) – centroid(k,2); % boundary(:,1) is y, but centroid(k,2) is y
deltaX = thisBoundary(:,2) – centroid(k,1); % boundary(:,2) is x, but centroid(k,1) is x
% angles = atand(deltaY ./ deltaX); % atand gives angles in range [-90,90]
angles = atan2d(deltaY,deltaX); % use atan2d to get angles in range [-180,180]
% 7.2. Calculate the radii
radius = sqrt(deltaY.^2 + deltaX.^2); % use deltaX and deltaY, which were just calculated
% 7.3. Add 360 degrees to negative angles so that range is [0,360] instead of [-180,180]
idx = angles < 0; %idx reps angles less than 0 degreees
angles(idx) = angles(idx)+360; %360 degrees is added to idx angles
%7.4. Sort angles in ascending order
% sort the angles, so the first one is smallest (closest to zero)
% and the last one is largest (closest to 360)
% this is useful for getting a smooth line that goes from 0 to 360 in the plot
% I returns the corresponding indices of the angles
[angles,I] = sort(angles);
%7.5. Reorder distances the same way angles was reordered using I
radius = radius(I);
%7.6. Use only unique angles in case an angle is repeated
% in case any angles are repeated, use only the unique set and
% corresponding distances in interp1 (in this data, one angle is
% repeated twice, with the same distance each time)
%The ~ (tilde) here is a placeholder indicating that we’re not interested
%in capturing the actual unique elements, only their indices
[~,I] = unique(angles);
% 7.7. perform linear interpolation/extrapolation:
%angles(I)= sample points, radius(I)= correspoinding points
%and interp_angles = coordinates of the querry points (QP)
%In general, the functions returns interpolated values at specific QP
interp_distances = interp1(angles(I),radius(I),interp_angles,’linear’,’extrap’);
% 7.8 Plot distance vs. angle.
plot(ax4,interp_angles,interp_distances)
end
%8. Apply fft algorithm to values of radius
L = length(interp_distances); %Define the number of the radiuses (points)
f = 0:L-1; %Define the sampling frequencies
A = fft(interp_distances); %Transforming the radius function into frequency domain using FFT
B = (abs(A)/2535.2); % Normalize the amplitude of fourier descriptors using the first descriptors
%9. Plot fft descriptor vs. frequency
subplot(3,3,5)
bar(f,B,3) %plot the frequencies vs. the nornalised descriptors
xlim([0 128])
%10. Plot phase angle vs. frequency
subplot(3,3,6)
bar(f, angle(A),3) % plot the frequencies vs phase angles
xlim([0 128])
ylim([-4 4])
%11. Create a table of values
table1 = table(A, f’, abs(A), B, angle(A));
table1.Properties.VariableNames = {‘FFT_coeffs’, ‘Frequency’, ‘Amplitude’, ‘Norm_Amplitude’ ‘Phase’};
disp(table1);
%12. Reconstruct particle boundary using FFT descriptors ????? fft, shape reconstruction, fourier descriptor MATLAB Answers — New Questions
How to treat 200 rows of data as an event when constructing a Timetable, as a piece of data, the size is 200*1
There is a table, if the sampling rate is set to 200 when constructing the Timetable,TT = timetable(var,’SampleRate’,200) ,then the time of each row of the Timetable is 0.005s, 0.01s etc, but what I want is that the time of each row is 1s, 2s, 3s, and the corresponding var data shape of each row is 200*1, what should I do?There is a table, if the sampling rate is set to 200 when constructing the Timetable,TT = timetable(var,’SampleRate’,200) ,then the time of each row of the Timetable is 0.005s, 0.01s etc, but what I want is that the time of each row is 1s, 2s, 3s, and the corresponding var data shape of each row is 200*1, what should I do? There is a table, if the sampling rate is set to 200 when constructing the Timetable,TT = timetable(var,’SampleRate’,200) ,then the time of each row of the Timetable is 0.005s, 0.01s etc, but what I want is that the time of each row is 1s, 2s, 3s, and the corresponding var data shape of each row is 200*1, what should I do? timetable MATLAB Answers — New Questions
My question is what is the value i am getting as the output of my code.
syms x
eqn = 0.5959 + 0.0321*(x^2.1)-0.184*(x^8)+0.0143*(x^2.5)-0.2359*(sqrt((1-x^4)/x^4));
solve(eqn == 0,x)
the results are given assyms x
eqn = 0.5959 + 0.0321*(x^2.1)-0.184*(x^8)+0.0143*(x^2.5)-0.2359*(sqrt((1-x^4)/x^4));
solve(eqn == 0,x)
the results are given as syms x
eqn = 0.5959 + 0.0321*(x^2.1)-0.184*(x^8)+0.0143*(x^2.5)-0.2359*(sqrt((1-x^4)/x^4));
solve(eqn == 0,x)
the results are given as linear equation MATLAB Answers — New Questions
TI C2000 f28388d SPI Tx and SPI Rx with multiple chip select GPIOs
My application requires connecting SPI to multiple devices using multiple chip select GPIOs. I tried to make the "Chip select pin" as a variable but it didn’t work. How can I implement this use case with multiple chip selects?My application requires connecting SPI to multiple devices using multiple chip select GPIOs. I tried to make the "Chip select pin" as a variable but it didn’t work. How can I implement this use case with multiple chip selects? My application requires connecting SPI to multiple devices using multiple chip select GPIOs. I tried to make the "Chip select pin" as a variable but it didn’t work. How can I implement this use case with multiple chip selects? spi, tms320f28388d MATLAB Answers — New Questions
Invalid setting in ‘Model’ for parameter ‘Gain’.
I am trying to tune a PID controller for controlling a plant model buit in Simulink. My aim is to obtain the gains of the PID controller using an optimization technique whose code is written in a script file. So, the objective function is calculated by obtaining the loged values from the simulink model. While I run my code, it always shows the error: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’, where the simulink file’s name is Model. Since I am tuning the gains using optimization, the are changing in each iteration. Kp, Ki, and Kd are the gains. The error is: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’.
function objective_func = F3(x)
Kp=x(1)
Ki=x(2)
Kd=x(3)
mdl = "Model";
open_system(mdl)
in = Simulink.SimulationInput(mdl)
out = sim(in)
simout = out.J(3001) %objective function value
objective_func=simout;
endI am trying to tune a PID controller for controlling a plant model buit in Simulink. My aim is to obtain the gains of the PID controller using an optimization technique whose code is written in a script file. So, the objective function is calculated by obtaining the loged values from the simulink model. While I run my code, it always shows the error: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’, where the simulink file’s name is Model. Since I am tuning the gains using optimization, the are changing in each iteration. Kp, Ki, and Kd are the gains. The error is: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’.
function objective_func = F3(x)
Kp=x(1)
Ki=x(2)
Kd=x(3)
mdl = "Model";
open_system(mdl)
in = Simulink.SimulationInput(mdl)
out = sim(in)
simout = out.J(3001) %objective function value
objective_func=simout;
end I am trying to tune a PID controller for controlling a plant model buit in Simulink. My aim is to obtain the gains of the PID controller using an optimization technique whose code is written in a script file. So, the objective function is calculated by obtaining the loged values from the simulink model. While I run my code, it always shows the error: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’, where the simulink file’s name is Model. Since I am tuning the gains using optimization, the are changing in each iteration. Kp, Ki, and Kd are the gains. The error is: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’.
function objective_func = F3(x)
Kp=x(1)
Ki=x(2)
Kd=x(3)
mdl = "Model";
open_system(mdl)
in = Simulink.SimulationInput(mdl)
out = sim(in)
simout = out.J(3001) %objective function value
objective_func=simout;
end simulink, gain block, optimization MATLAB Answers — New Questions
Interpolation of two-dimensional within a given space window
Dear all
I am attaching a dataset, called "Points.txt", where the first and second columns represent the spatial coordinates along the x- and y-th directions, respectively, and the third column the value of a variable at each listed pair of points (x,y). I was wondering which could be a good way to increase the number of points mainly inside the hexagonal shape within the current listed points are restricted to:
I have tried the following:
pgon=nsidedpoly(6,’Center’,[0 0],’SideLength’,1);
%% Let’s rearrange the data associated to the interlayer isotropic exchange, Jinter
% Let’s load the preliminar data
Jinter=cell2mat(struct2cell(load(strcat(pwd,’Preliminar-DataJinter.mat’))));
% Let’s construct the unit vectors of the in-plane unit cell
x=unique(Jinter(:,1));
y=unique(Jinter(:,2));
a1_points=[max(x) 0];
a2_points=[-0.5 max(y)];
a1_modulus=sqrt(dot(a1_points,a1_points));
a2_modulus=sqrt(dot(a2_points,a2_points));
a1=a1_points./a1_modulus;
a2=a2_points./a2_modulus;
% Let’s construct the supercell for Jinter
diff_y=max(y)-min(y);
counter=0;
for dy=[-1 0 1]
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)++dy*[0 1]*diff_y)~=any(Jinter(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+dy*[0 1]*diff_y;
Jinter_extended(counter,3)=Jinter(i,3);
end
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[a1(1)+abs(a2(1)) abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[a1(1)+abs(a2(1)) abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[a1(1)+abs(a2(1)) -abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[a1(1)+abs(a2(1)) -abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) -abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) -abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
clear a1 a2 a1_modulus a2_modulus a1_points a2_points Jinter diff_y x y dy
% Let’s plot it
u17=figure(17)
scatter(Jinter_extended(:,1),Jinter_extended(:,2),[],Jinter_extended(:,3),’o’,’filled’);
colormap(gca,bluewhitered(256));
clim([min(Jinter_extended(:,3)) max(Jinter_extended(:,3))]);
clr17=colorbar;
box on;
pbaspect([1 6/4 1]);
clear u17 clr17
% Now, let’s interpolate data
x_extended=linspace(min(Jinter_extended(:,1)),max(Jinter_extended(:,1)));
y_extended=linspace(min(Jinter_extended(:,2)),max(Jinter_extended(:,2)));
Jinter_interpolated=RegularizeData3D(Jinter_extended(:,1),Jinter_extended(:,2),Jinter_extended(:,3),x_extended,y_extended,’interp’,’bicubic’,’smoothness’,1e-4);
x_interpolation=linspace(-1,1,201);
y_interpolation=linspace(-sqrt(3)/2,sqrt(3)/2,201);
[X,Y]=meshgrid(x_interpolation,y_interpolation);
interpolated_Jinter=interp2(x_extended,y_extended,Jinter_interpolated,X,Y,’cubic’);
clear X Y Jinter_interpolated x_extended y_extended Jinter_extended
% Let’s plot it
u18=figure(18)
uimagesc(x_interpolation,y_interpolation,interpolated_Jinter);
colormap(gca,bluewhitered(256));
% hold on
axis xy;
% plot(pgon);
clim([min(min(interpolated_Jinter)) max(max(interpolated_Jinter))]);
clr18=colorbar;
box on;
pbaspect([1 sqrt(3)/2 1]);
clear u18 clr18
% Now, let’s rearrange and save the data
x_intermediate=linspace(-100,100,201);
y_intermediate=linspace(-100,100,201);
counter=0;
for i=1:length(x_interpolation)
for j=1:length(y_interpolation)
counter=counter+1;
Jinter_save(counter,1)=x_intermediate(i);
Jinter_save(counter,2)=y_intermediate(j);
Jinter_save(counter,3)=interpolated_Jinter(i,j);
end
end
writematrix(Jinter_save,strcat(pwd,’Interpolated-DataInterpolated_J_Inter.txt’),’Delimiter’,’space’);
clear interpolated_Jinter Jinter_save x_interpolation y_interpolation counter i j x_intermediate y_intermediate
where the "Jinter.mat" is exactly the same dataset as in "Points.txt". The problem with this is that, for example, if I take a look at the generated "Interpolated_J_Inter.txt", the value for (0,0) differs notably.
Any ideas?Dear all
I am attaching a dataset, called "Points.txt", where the first and second columns represent the spatial coordinates along the x- and y-th directions, respectively, and the third column the value of a variable at each listed pair of points (x,y). I was wondering which could be a good way to increase the number of points mainly inside the hexagonal shape within the current listed points are restricted to:
I have tried the following:
pgon=nsidedpoly(6,’Center’,[0 0],’SideLength’,1);
%% Let’s rearrange the data associated to the interlayer isotropic exchange, Jinter
% Let’s load the preliminar data
Jinter=cell2mat(struct2cell(load(strcat(pwd,’Preliminar-DataJinter.mat’))));
% Let’s construct the unit vectors of the in-plane unit cell
x=unique(Jinter(:,1));
y=unique(Jinter(:,2));
a1_points=[max(x) 0];
a2_points=[-0.5 max(y)];
a1_modulus=sqrt(dot(a1_points,a1_points));
a2_modulus=sqrt(dot(a2_points,a2_points));
a1=a1_points./a1_modulus;
a2=a2_points./a2_modulus;
% Let’s construct the supercell for Jinter
diff_y=max(y)-min(y);
counter=0;
for dy=[-1 0 1]
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)++dy*[0 1]*diff_y)~=any(Jinter(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+dy*[0 1]*diff_y;
Jinter_extended(counter,3)=Jinter(i,3);
end
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[a1(1)+abs(a2(1)) abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[a1(1)+abs(a2(1)) abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[a1(1)+abs(a2(1)) -abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[a1(1)+abs(a2(1)) -abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) -abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) -abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
clear a1 a2 a1_modulus a2_modulus a1_points a2_points Jinter diff_y x y dy
% Let’s plot it
u17=figure(17)
scatter(Jinter_extended(:,1),Jinter_extended(:,2),[],Jinter_extended(:,3),’o’,’filled’);
colormap(gca,bluewhitered(256));
clim([min(Jinter_extended(:,3)) max(Jinter_extended(:,3))]);
clr17=colorbar;
box on;
pbaspect([1 6/4 1]);
clear u17 clr17
% Now, let’s interpolate data
x_extended=linspace(min(Jinter_extended(:,1)),max(Jinter_extended(:,1)));
y_extended=linspace(min(Jinter_extended(:,2)),max(Jinter_extended(:,2)));
Jinter_interpolated=RegularizeData3D(Jinter_extended(:,1),Jinter_extended(:,2),Jinter_extended(:,3),x_extended,y_extended,’interp’,’bicubic’,’smoothness’,1e-4);
x_interpolation=linspace(-1,1,201);
y_interpolation=linspace(-sqrt(3)/2,sqrt(3)/2,201);
[X,Y]=meshgrid(x_interpolation,y_interpolation);
interpolated_Jinter=interp2(x_extended,y_extended,Jinter_interpolated,X,Y,’cubic’);
clear X Y Jinter_interpolated x_extended y_extended Jinter_extended
% Let’s plot it
u18=figure(18)
uimagesc(x_interpolation,y_interpolation,interpolated_Jinter);
colormap(gca,bluewhitered(256));
% hold on
axis xy;
% plot(pgon);
clim([min(min(interpolated_Jinter)) max(max(interpolated_Jinter))]);
clr18=colorbar;
box on;
pbaspect([1 sqrt(3)/2 1]);
clear u18 clr18
% Now, let’s rearrange and save the data
x_intermediate=linspace(-100,100,201);
y_intermediate=linspace(-100,100,201);
counter=0;
for i=1:length(x_interpolation)
for j=1:length(y_interpolation)
counter=counter+1;
Jinter_save(counter,1)=x_intermediate(i);
Jinter_save(counter,2)=y_intermediate(j);
Jinter_save(counter,3)=interpolated_Jinter(i,j);
end
end
writematrix(Jinter_save,strcat(pwd,’Interpolated-DataInterpolated_J_Inter.txt’),’Delimiter’,’space’);
clear interpolated_Jinter Jinter_save x_interpolation y_interpolation counter i j x_intermediate y_intermediate
where the "Jinter.mat" is exactly the same dataset as in "Points.txt". The problem with this is that, for example, if I take a look at the generated "Interpolated_J_Inter.txt", the value for (0,0) differs notably.
Any ideas? Dear all
I am attaching a dataset, called "Points.txt", where the first and second columns represent the spatial coordinates along the x- and y-th directions, respectively, and the third column the value of a variable at each listed pair of points (x,y). I was wondering which could be a good way to increase the number of points mainly inside the hexagonal shape within the current listed points are restricted to:
I have tried the following:
pgon=nsidedpoly(6,’Center’,[0 0],’SideLength’,1);
%% Let’s rearrange the data associated to the interlayer isotropic exchange, Jinter
% Let’s load the preliminar data
Jinter=cell2mat(struct2cell(load(strcat(pwd,’Preliminar-DataJinter.mat’))));
% Let’s construct the unit vectors of the in-plane unit cell
x=unique(Jinter(:,1));
y=unique(Jinter(:,2));
a1_points=[max(x) 0];
a2_points=[-0.5 max(y)];
a1_modulus=sqrt(dot(a1_points,a1_points));
a2_modulus=sqrt(dot(a2_points,a2_points));
a1=a1_points./a1_modulus;
a2=a2_points./a2_modulus;
% Let’s construct the supercell for Jinter
diff_y=max(y)-min(y);
counter=0;
for dy=[-1 0 1]
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)++dy*[0 1]*diff_y)~=any(Jinter(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+dy*[0 1]*diff_y;
Jinter_extended(counter,3)=Jinter(i,3);
end
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[a1(1)+abs(a2(1)) abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[a1(1)+abs(a2(1)) abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[a1(1)+abs(a2(1)) -abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[a1(1)+abs(a2(1)) -abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
counter=length(Jinter_extended(:,1));
for i=1:length(Jinter(:,1))
if (Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) -abs(a2(2))])~=any(Jinter_extended(:,1:2))
counter=counter+1;
Jinter_extended(counter,1:2)=Jinter(i,1:2)+[-(a1(1)+abs(a2(1))) -abs(a2(2))];
Jinter_extended(counter,3)=Jinter(i,3);
end
end
clear a1 a2 a1_modulus a2_modulus a1_points a2_points Jinter diff_y x y dy
% Let’s plot it
u17=figure(17)
scatter(Jinter_extended(:,1),Jinter_extended(:,2),[],Jinter_extended(:,3),’o’,’filled’);
colormap(gca,bluewhitered(256));
clim([min(Jinter_extended(:,3)) max(Jinter_extended(:,3))]);
clr17=colorbar;
box on;
pbaspect([1 6/4 1]);
clear u17 clr17
% Now, let’s interpolate data
x_extended=linspace(min(Jinter_extended(:,1)),max(Jinter_extended(:,1)));
y_extended=linspace(min(Jinter_extended(:,2)),max(Jinter_extended(:,2)));
Jinter_interpolated=RegularizeData3D(Jinter_extended(:,1),Jinter_extended(:,2),Jinter_extended(:,3),x_extended,y_extended,’interp’,’bicubic’,’smoothness’,1e-4);
x_interpolation=linspace(-1,1,201);
y_interpolation=linspace(-sqrt(3)/2,sqrt(3)/2,201);
[X,Y]=meshgrid(x_interpolation,y_interpolation);
interpolated_Jinter=interp2(x_extended,y_extended,Jinter_interpolated,X,Y,’cubic’);
clear X Y Jinter_interpolated x_extended y_extended Jinter_extended
% Let’s plot it
u18=figure(18)
uimagesc(x_interpolation,y_interpolation,interpolated_Jinter);
colormap(gca,bluewhitered(256));
% hold on
axis xy;
% plot(pgon);
clim([min(min(interpolated_Jinter)) max(max(interpolated_Jinter))]);
clr18=colorbar;
box on;
pbaspect([1 sqrt(3)/2 1]);
clear u18 clr18
% Now, let’s rearrange and save the data
x_intermediate=linspace(-100,100,201);
y_intermediate=linspace(-100,100,201);
counter=0;
for i=1:length(x_interpolation)
for j=1:length(y_interpolation)
counter=counter+1;
Jinter_save(counter,1)=x_intermediate(i);
Jinter_save(counter,2)=y_intermediate(j);
Jinter_save(counter,3)=interpolated_Jinter(i,j);
end
end
writematrix(Jinter_save,strcat(pwd,’Interpolated-DataInterpolated_J_Inter.txt’),’Delimiter’,’space’);
clear interpolated_Jinter Jinter_save x_interpolation y_interpolation counter i j x_intermediate y_intermediate
where the "Jinter.mat" is exactly the same dataset as in "Points.txt". The problem with this is that, for example, if I take a look at the generated "Interpolated_J_Inter.txt", the value for (0,0) differs notably.
Any ideas? interpolate two-dimensional data MATLAB Answers — New Questions
Simulink generated code optimization – CPU Load
Hi all,
I’m successfully generating code from the Simulink model. This code substitute manual one with the same function. Code is the integrated with the rest of the manual code, flashed to the HW and running. This substituting of the manual code part with the generated one increses the CPU Load. When I’m checking the Code generation setting, basic targets are RAM minimazing or Execution speed mazimazing. Non of these will directly reduce the CPU Load I suppose.
So I’d like to ask you, do you know what Advanced or Detailed Code generation Optimization setting can reduce the CPU Load? I’m attaching screenshots of the current setting.
And possibly follow up question – is there any metric which can estimate affect on the CPU Load without need of flashing the integrated code to the HW?
Thank you for your help in advance, have a nice day!
OldrichHi all,
I’m successfully generating code from the Simulink model. This code substitute manual one with the same function. Code is the integrated with the rest of the manual code, flashed to the HW and running. This substituting of the manual code part with the generated one increses the CPU Load. When I’m checking the Code generation setting, basic targets are RAM minimazing or Execution speed mazimazing. Non of these will directly reduce the CPU Load I suppose.
So I’d like to ask you, do you know what Advanced or Detailed Code generation Optimization setting can reduce the CPU Load? I’m attaching screenshots of the current setting.
And possibly follow up question – is there any metric which can estimate affect on the CPU Load without need of flashing the integrated code to the HW?
Thank you for your help in advance, have a nice day!
Oldrich Hi all,
I’m successfully generating code from the Simulink model. This code substitute manual one with the same function. Code is the integrated with the rest of the manual code, flashed to the HW and running. This substituting of the manual code part with the generated one increses the CPU Load. When I’m checking the Code generation setting, basic targets are RAM minimazing or Execution speed mazimazing. Non of these will directly reduce the CPU Load I suppose.
So I’d like to ask you, do you know what Advanced or Detailed Code generation Optimization setting can reduce the CPU Load? I’m attaching screenshots of the current setting.
And possibly follow up question – is there any metric which can estimate affect on the CPU Load without need of flashing the integrated code to the HW?
Thank you for your help in advance, have a nice day!
Oldrich embedded coder MATLAB Answers — New Questions
Plotting a system of fractional order differential equations
Hi. I have been trying to plot fractional order differential equations with MATLAB. I have tried to use this technique called "Predictor-Corrector Method" and got a code listing using AI. The code seems to be giving the plots, though they do not match with the expected results. I will attach the code listing below. But my question is how to actually plot such systems? Is there a standard method in-built, or a widely accepted add-on/package? Thanks. “`% Parameters
alpha = 0.9;
LAMBDA = 3;
mu = 0.4;
beta = 0.004;
gamma = 0.0005;
m = 0.03;
n = 0.006;
delta = 0.02;
rho = 0.003;
h = 0.1; % Time step
T = 300; % Total time
% Time steps
time = 0:h:T;
time_steps = length(time);
% Initial conditions
s = zeros(1, time_steps);
i = zeros(1, time_steps);
r = zeros(1, time_steps);
s(1) = 85;
i(1) = 3;
r(1) = 0;
% Predictor-Corrector Method
for k = 1:(time_steps – 1)
% Predictor step (Adams-Bashforth)
if k == 1
ds_pred = h * (LAMBDA – mu * s(k) – (beta * s(k) * i(k)) / (1 + gamma * i(k)));
di_pred = h * ((beta * s(k) * i(k)) / (1 + gamma * i(k)) – (m * i(k)) / (1 + n * i(k)) – (mu + delta + rho) * i(k));
dr_pred = h * ((m * i(k)) / (1 + n * i(k)) + delta * i(k) – mu * r(k));
else
ds_pred = h / 2 * ((LAMBDA – mu * s(k) – (beta * s(k) * i(k)) / (1 + gamma * i(k))) + …
(LAMBDA – mu * s(k-1) – (beta * s(k-1) * i(k-1)) / (1 + gamma * i(k-1))));
di_pred = h / 2 * (((beta * s(k) * i(k)) / (1 + gamma * i(k)) – (m * i(k)) / (1 + n * i(k)) – (mu + delta + rho) * i(k)) + …
((beta * s(k-1) * i(k-1)) / (1 + gamma * i(k-1)) – (m * i(k-1)) / (1 + n * i(k-1)) – (mu + delta + rho) * i(k-1)));
dr_pred = h / 2 * (((m * i(k)) / (1 + n * i(k)) + delta * i(k) – mu * r(k)) + …
((m * i(k-1)) / (1 + n * i(k-1)) + delta * i(k-1) – mu * r(k-1)));
end
% Update predicted values
s(k + 1) = s(k) + ds_pred;
i(k + 1) = i(k) + di_pred;
r(k + 1) = r(k) + dr_pred;
% Corrector step (Adams-Moulton)
ds_corr = h / 2 * ((LAMBDA – mu * s(k + 1) – (beta * s(k + 1) * i(k + 1)) / (1 + gamma * i(k + 1))) + …
(LAMBDA – mu * s(k) – (beta * s(k) * i(k)) / (1 + gamma * i(k))));
di_corr = h / 2 * (((beta * s(k + 1) * i(k + 1)) / (1 + gamma * i(k + 1)) – (m * i(k + 1)) / (1 + n * i(k + 1)) – (mu + delta + rho) * i(k + 1)) + …
((beta * s(k) * i(k)) / (1 + gamma * i(k)) – (m * i(k)) / (1 + n * i(k)) – (mu + delta + rho) * i(k)));
dr_corr = h / 2 * (((m * i(k + 1)) / (1 + n * i(k + 1)) + delta * i(k + 1) – mu * r(k + 1)) + …
((m * i(k)) / (1 + n * i(k)) + delta * i(k) – mu * r(k)));
% Update corrected values
s(k + 1) = s(k) + ds_corr;
i(k + 1) = i(k) + di_corr;
r(k + 1) = r(k) + dr_corr;
end
% Plot the results
figure;
plot(time, s, ‘-o’, ‘DisplayName’, ‘s(t)’);
hold on;
plot(time, i, ‘-s’, ‘DisplayName’, ‘i(t)’);
plot(time, r, ‘-d’, ‘DisplayName’, ‘r(t)’);
xlabel(‘Time’);
ylabel(‘Population’);
title(‘Solution of the System of Fractional Differential Equations’);
legend;
grid on;
% Set plot range
xlim([0 30]);
ylim([0 100]);“`
<</matlabcentral/answers/uploaded_files/1745286/fo_M.png>>Hi. I have been trying to plot fractional order differential equations with MATLAB. I have tried to use this technique called "Predictor-Corrector Method" and got a code listing using AI. The code seems to be giving the plots, though they do not match with the expected results. I will attach the code listing below. But my question is how to actually plot such systems? Is there a standard method in-built, or a widely accepted add-on/package? Thanks. “`% Parameters
alpha = 0.9;
LAMBDA = 3;
mu = 0.4;
beta = 0.004;
gamma = 0.0005;
m = 0.03;
n = 0.006;
delta = 0.02;
rho = 0.003;
h = 0.1; % Time step
T = 300; % Total time
% Time steps
time = 0:h:T;
time_steps = length(time);
% Initial conditions
s = zeros(1, time_steps);
i = zeros(1, time_steps);
r = zeros(1, time_steps);
s(1) = 85;
i(1) = 3;
r(1) = 0;
% Predictor-Corrector Method
for k = 1:(time_steps – 1)
% Predictor step (Adams-Bashforth)
if k == 1
ds_pred = h * (LAMBDA – mu * s(k) – (beta * s(k) * i(k)) / (1 + gamma * i(k)));
di_pred = h * ((beta * s(k) * i(k)) / (1 + gamma * i(k)) – (m * i(k)) / (1 + n * i(k)) – (mu + delta + rho) * i(k));
dr_pred = h * ((m * i(k)) / (1 + n * i(k)) + delta * i(k) – mu * r(k));
else
ds_pred = h / 2 * ((LAMBDA – mu * s(k) – (beta * s(k) * i(k)) / (1 + gamma * i(k))) + …
(LAMBDA – mu * s(k-1) – (beta * s(k-1) * i(k-1)) / (1 + gamma * i(k-1))));
di_pred = h / 2 * (((beta * s(k) * i(k)) / (1 + gamma * i(k)) – (m * i(k)) / (1 + n * i(k)) – (mu + delta + rho) * i(k)) + …
((beta * s(k-1) * i(k-1)) / (1 + gamma * i(k-1)) – (m * i(k-1)) / (1 + n * i(k-1)) – (mu + delta + rho) * i(k-1)));
dr_pred = h / 2 * (((m * i(k)) / (1 + n * i(k)) + delta * i(k) – mu * r(k)) + …
((m * i(k-1)) / (1 + n * i(k-1)) + delta * i(k-1) – mu * r(k-1)));
end
% Update predicted values
s(k + 1) = s(k) + ds_pred;
i(k + 1) = i(k) + di_pred;
r(k + 1) = r(k) + dr_pred;
% Corrector step (Adams-Moulton)
ds_corr = h / 2 * ((LAMBDA – mu * s(k + 1) – (beta * s(k + 1) * i(k + 1)) / (1 + gamma * i(k + 1))) + …
(LAMBDA – mu * s(k) – (beta * s(k) * i(k)) / (1 + gamma * i(k))));
di_corr = h / 2 * (((beta * s(k + 1) * i(k + 1)) / (1 + gamma * i(k + 1)) – (m * i(k + 1)) / (1 + n * i(k + 1)) – (mu + delta + rho) * i(k + 1)) + …
((beta * s(k) * i(k)) / (1 + gamma * i(k)) – (m * i(k)) / (1 + n * i(k)) – (mu + delta + rho) * i(k)));
dr_corr = h / 2 * (((m * i(k + 1)) / (1 + n * i(k + 1)) + delta * i(k + 1) – mu * r(k + 1)) + …
((m * i(k)) / (1 + n * i(k)) + delta * i(k) – mu * r(k)));
% Update corrected values
s(k + 1) = s(k) + ds_corr;
i(k + 1) = i(k) + di_corr;
r(k + 1) = r(k) + dr_corr;
end
% Plot the results
figure;
plot(time, s, ‘-o’, ‘DisplayName’, ‘s(t)’);
hold on;
plot(time, i, ‘-s’, ‘DisplayName’, ‘i(t)’);
plot(time, r, ‘-d’, ‘DisplayName’, ‘r(t)’);
xlabel(‘Time’);
ylabel(‘Population’);
title(‘Solution of the System of Fractional Differential Equations’);
legend;
grid on;
% Set plot range
xlim([0 30]);
ylim([0 100]);“`
<</matlabcentral/answers/uploaded_files/1745286/fo_M.png>> Hi. I have been trying to plot fractional order differential equations with MATLAB. I have tried to use this technique called "Predictor-Corrector Method" and got a code listing using AI. The code seems to be giving the plots, though they do not match with the expected results. I will attach the code listing below. But my question is how to actually plot such systems? Is there a standard method in-built, or a widely accepted add-on/package? Thanks. “`% Parameters
alpha = 0.9;
LAMBDA = 3;
mu = 0.4;
beta = 0.004;
gamma = 0.0005;
m = 0.03;
n = 0.006;
delta = 0.02;
rho = 0.003;
h = 0.1; % Time step
T = 300; % Total time
% Time steps
time = 0:h:T;
time_steps = length(time);
% Initial conditions
s = zeros(1, time_steps);
i = zeros(1, time_steps);
r = zeros(1, time_steps);
s(1) = 85;
i(1) = 3;
r(1) = 0;
% Predictor-Corrector Method
for k = 1:(time_steps – 1)
% Predictor step (Adams-Bashforth)
if k == 1
ds_pred = h * (LAMBDA – mu * s(k) – (beta * s(k) * i(k)) / (1 + gamma * i(k)));
di_pred = h * ((beta * s(k) * i(k)) / (1 + gamma * i(k)) – (m * i(k)) / (1 + n * i(k)) – (mu + delta + rho) * i(k));
dr_pred = h * ((m * i(k)) / (1 + n * i(k)) + delta * i(k) – mu * r(k));
else
ds_pred = h / 2 * ((LAMBDA – mu * s(k) – (beta * s(k) * i(k)) / (1 + gamma * i(k))) + …
(LAMBDA – mu * s(k-1) – (beta * s(k-1) * i(k-1)) / (1 + gamma * i(k-1))));
di_pred = h / 2 * (((beta * s(k) * i(k)) / (1 + gamma * i(k)) – (m * i(k)) / (1 + n * i(k)) – (mu + delta + rho) * i(k)) + …
((beta * s(k-1) * i(k-1)) / (1 + gamma * i(k-1)) – (m * i(k-1)) / (1 + n * i(k-1)) – (mu + delta + rho) * i(k-1)));
dr_pred = h / 2 * (((m * i(k)) / (1 + n * i(k)) + delta * i(k) – mu * r(k)) + …
((m * i(k-1)) / (1 + n * i(k-1)) + delta * i(k-1) – mu * r(k-1)));
end
% Update predicted values
s(k + 1) = s(k) + ds_pred;
i(k + 1) = i(k) + di_pred;
r(k + 1) = r(k) + dr_pred;
% Corrector step (Adams-Moulton)
ds_corr = h / 2 * ((LAMBDA – mu * s(k + 1) – (beta * s(k + 1) * i(k + 1)) / (1 + gamma * i(k + 1))) + …
(LAMBDA – mu * s(k) – (beta * s(k) * i(k)) / (1 + gamma * i(k))));
di_corr = h / 2 * (((beta * s(k + 1) * i(k + 1)) / (1 + gamma * i(k + 1)) – (m * i(k + 1)) / (1 + n * i(k + 1)) – (mu + delta + rho) * i(k + 1)) + …
((beta * s(k) * i(k)) / (1 + gamma * i(k)) – (m * i(k)) / (1 + n * i(k)) – (mu + delta + rho) * i(k)));
dr_corr = h / 2 * (((m * i(k + 1)) / (1 + n * i(k + 1)) + delta * i(k + 1) – mu * r(k + 1)) + …
((m * i(k)) / (1 + n * i(k)) + delta * i(k) – mu * r(k)));
% Update corrected values
s(k + 1) = s(k) + ds_corr;
i(k + 1) = i(k) + di_corr;
r(k + 1) = r(k) + dr_corr;
end
% Plot the results
figure;
plot(time, s, ‘-o’, ‘DisplayName’, ‘s(t)’);
hold on;
plot(time, i, ‘-s’, ‘DisplayName’, ‘i(t)’);
plot(time, r, ‘-d’, ‘DisplayName’, ‘r(t)’);
xlabel(‘Time’);
ylabel(‘Population’);
title(‘Solution of the System of Fractional Differential Equations’);
legend;
grid on;
% Set plot range
xlim([0 30]);
ylim([0 100]);“`
<</matlabcentral/answers/uploaded_files/1745286/fo_M.png>> fde MATLAB Answers — New Questions
Three phase measurement block measuring current lower than expected
I have three controlled current sources connected as a load. The currents sources are used to simulate harmonic currents. I also have three phase filter banks used to filter our the harmonics. I have multiple three measurement blocks all set to phase-to-phase measurements. One measurement block (line) is connected to the transformer secondary. One measurement block (load) connected to the controlled current sources. One measurement block (caps) is connected to the capacitors. I would expect the following line current = load current + capacitor current (see be drawing below). Both the controlled current sources and the capacitors have a significant amount of current flow. Why doesn’t the transformer secondary current = capacitor current + controller current source load?
Here is my controlled current source configuration. The sine waves are populated from a MATLAB data variable.I have three controlled current sources connected as a load. The currents sources are used to simulate harmonic currents. I also have three phase filter banks used to filter our the harmonics. I have multiple three measurement blocks all set to phase-to-phase measurements. One measurement block (line) is connected to the transformer secondary. One measurement block (load) connected to the controlled current sources. One measurement block (caps) is connected to the capacitors. I would expect the following line current = load current + capacitor current (see be drawing below). Both the controlled current sources and the capacitors have a significant amount of current flow. Why doesn’t the transformer secondary current = capacitor current + controller current source load?
Here is my controlled current source configuration. The sine waves are populated from a MATLAB data variable. I have three controlled current sources connected as a load. The currents sources are used to simulate harmonic currents. I also have three phase filter banks used to filter our the harmonics. I have multiple three measurement blocks all set to phase-to-phase measurements. One measurement block (line) is connected to the transformer secondary. One measurement block (load) connected to the controlled current sources. One measurement block (caps) is connected to the capacitors. I would expect the following line current = load current + capacitor current (see be drawing below). Both the controlled current sources and the capacitors have a significant amount of current flow. Why doesn’t the transformer secondary current = capacitor current + controller current source load?
Here is my controlled current source configuration. The sine waves are populated from a MATLAB data variable. current measurement MATLAB Answers — New Questions
How can I create this 2D waterfall plot?
The data is from a CSV file with one time column and 32 columns of data.
The curves show the Amplitude vs. Time behavior of the sensors while the sensor locations (in meters) are placed on the Y-axis.
I assume this is a waterfall plot, but I can’t reproduce it. How can I make a graph like this one?The data is from a CSV file with one time column and 32 columns of data.
The curves show the Amplitude vs. Time behavior of the sensors while the sensor locations (in meters) are placed on the Y-axis.
I assume this is a waterfall plot, but I can’t reproduce it. How can I make a graph like this one? The data is from a CSV file with one time column and 32 columns of data.
The curves show the Amplitude vs. Time behavior of the sensors while the sensor locations (in meters) are placed on the Y-axis.
I assume this is a waterfall plot, but I can’t reproduce it. How can I make a graph like this one? plotting, plot, waterfall, figure MATLAB Answers — New Questions
Index exceeds the number of array elements. Index must not exceed 101.
Please help me fix the following error: "Index exceeds the number of array elements. Index must not exceed 101." thank you very much!
%% Phase plane
clear all
clc
%% conditions
A=[-0.8 0.1;0.15 -0.15];
A_h=[-0.4 0.2;0.1 0.04];
A_d=[0.2 0.5;-0.3 0.05];
A_u=[0.1;-0.1];
A_c=[-76.0089 387.8927;75.3589 -387.9427];
stime=1.0;
endtime=30;
h=0.01;
t=-stime:h:endtime;
N_0=stime/h;
N_1=endtime/h;
N=N_0+N_1;
%bound=110;
for i=1:N+1
if i<=N_0+1;
x1(:,i)=0.05*sin((i-N_0-1)*h);
x2(:,i)=0.05*cos((i-N_0-1)*h);
else
d_1=floor(1.5+0.5*sin(1.5*i*h));
d_2=floor(2+cos(2.5*i*h));
if i<=4
x1(:,i)=x1(:,i-1)+h*(A_c(1,1)*x1(:,i-1)+A_c(1,2)*x2(:,i-1));
x2(:,i)=x2(:,i-1)+h*(A_c(2,1)*x1(:,i-1)+A_c(2,2)*x2(:,i-1));
else
x1(:,i)=x1(:,i-1)+h*(A_c(1,1)*x1(:,i-1)+A_c(1,2)*x2(:,i-1)+A_h(1,1)*x1(:,i-d_1-1)+A_h(1,2)*x2(:,i-d_1-1)+(1/2)*(A_d(1,1)*(x1(i-1)+x1(i-d_2-1)+2*(x1(i-d_2)+x1(i-d_2+1)))+A_d(1,2)*(x2(i-1)+x2(i-d_2-1)+2*(x2(i-d_2)+x2(i-d_2+1)))));
x2(:,i)=x2(:,i-1)+h*(A_c(2,1)*x1(:,i-1)+A_c(2,2)*x2(:,i-1)+A_h(2,1)*x1(:,i-d_1-1)+A_h(2,2)*x2(:,i-d_1-1)+(1/2)*(A_d(2,1)*(x1(i-1)+x1(i-d_2-1)+2*(x1(i-2)+x1(i-3)+x1(i-4)))+A_d(2,2)*(x2(i-1)+x2(i-d_2-1)+2*(x2(i-2)+x2(i-3)+x2(i-4)))));
end
end
end
%% Plotting Graphs
figure
grid on
hold on
box on
plot(t,x1(1,:),’-g’,t,x2(1,:),’r-‘,’linewidth’,2.5)
hold on
xlabel(‘Time (t)’)
%ylabel(‘State responses’)
legend(‘x_{1}(t)’,’x_{2}(t)’);
xlim([0,30]);
ylim([-100,100]);
%Please help me fix the following error: "Index exceeds the number of array elements. Index must not exceed 101." thank you very much!
%% Phase plane
clear all
clc
%% conditions
A=[-0.8 0.1;0.15 -0.15];
A_h=[-0.4 0.2;0.1 0.04];
A_d=[0.2 0.5;-0.3 0.05];
A_u=[0.1;-0.1];
A_c=[-76.0089 387.8927;75.3589 -387.9427];
stime=1.0;
endtime=30;
h=0.01;
t=-stime:h:endtime;
N_0=stime/h;
N_1=endtime/h;
N=N_0+N_1;
%bound=110;
for i=1:N+1
if i<=N_0+1;
x1(:,i)=0.05*sin((i-N_0-1)*h);
x2(:,i)=0.05*cos((i-N_0-1)*h);
else
d_1=floor(1.5+0.5*sin(1.5*i*h));
d_2=floor(2+cos(2.5*i*h));
if i<=4
x1(:,i)=x1(:,i-1)+h*(A_c(1,1)*x1(:,i-1)+A_c(1,2)*x2(:,i-1));
x2(:,i)=x2(:,i-1)+h*(A_c(2,1)*x1(:,i-1)+A_c(2,2)*x2(:,i-1));
else
x1(:,i)=x1(:,i-1)+h*(A_c(1,1)*x1(:,i-1)+A_c(1,2)*x2(:,i-1)+A_h(1,1)*x1(:,i-d_1-1)+A_h(1,2)*x2(:,i-d_1-1)+(1/2)*(A_d(1,1)*(x1(i-1)+x1(i-d_2-1)+2*(x1(i-d_2)+x1(i-d_2+1)))+A_d(1,2)*(x2(i-1)+x2(i-d_2-1)+2*(x2(i-d_2)+x2(i-d_2+1)))));
x2(:,i)=x2(:,i-1)+h*(A_c(2,1)*x1(:,i-1)+A_c(2,2)*x2(:,i-1)+A_h(2,1)*x1(:,i-d_1-1)+A_h(2,2)*x2(:,i-d_1-1)+(1/2)*(A_d(2,1)*(x1(i-1)+x1(i-d_2-1)+2*(x1(i-2)+x1(i-3)+x1(i-4)))+A_d(2,2)*(x2(i-1)+x2(i-d_2-1)+2*(x2(i-2)+x2(i-3)+x2(i-4)))));
end
end
end
%% Plotting Graphs
figure
grid on
hold on
box on
plot(t,x1(1,:),’-g’,t,x2(1,:),’r-‘,’linewidth’,2.5)
hold on
xlabel(‘Time (t)’)
%ylabel(‘State responses’)
legend(‘x_{1}(t)’,’x_{2}(t)’);
xlim([0,30]);
ylim([-100,100]);
% Please help me fix the following error: "Index exceeds the number of array elements. Index must not exceed 101." thank you very much!
%% Phase plane
clear all
clc
%% conditions
A=[-0.8 0.1;0.15 -0.15];
A_h=[-0.4 0.2;0.1 0.04];
A_d=[0.2 0.5;-0.3 0.05];
A_u=[0.1;-0.1];
A_c=[-76.0089 387.8927;75.3589 -387.9427];
stime=1.0;
endtime=30;
h=0.01;
t=-stime:h:endtime;
N_0=stime/h;
N_1=endtime/h;
N=N_0+N_1;
%bound=110;
for i=1:N+1
if i<=N_0+1;
x1(:,i)=0.05*sin((i-N_0-1)*h);
x2(:,i)=0.05*cos((i-N_0-1)*h);
else
d_1=floor(1.5+0.5*sin(1.5*i*h));
d_2=floor(2+cos(2.5*i*h));
if i<=4
x1(:,i)=x1(:,i-1)+h*(A_c(1,1)*x1(:,i-1)+A_c(1,2)*x2(:,i-1));
x2(:,i)=x2(:,i-1)+h*(A_c(2,1)*x1(:,i-1)+A_c(2,2)*x2(:,i-1));
else
x1(:,i)=x1(:,i-1)+h*(A_c(1,1)*x1(:,i-1)+A_c(1,2)*x2(:,i-1)+A_h(1,1)*x1(:,i-d_1-1)+A_h(1,2)*x2(:,i-d_1-1)+(1/2)*(A_d(1,1)*(x1(i-1)+x1(i-d_2-1)+2*(x1(i-d_2)+x1(i-d_2+1)))+A_d(1,2)*(x2(i-1)+x2(i-d_2-1)+2*(x2(i-d_2)+x2(i-d_2+1)))));
x2(:,i)=x2(:,i-1)+h*(A_c(2,1)*x1(:,i-1)+A_c(2,2)*x2(:,i-1)+A_h(2,1)*x1(:,i-d_1-1)+A_h(2,2)*x2(:,i-d_1-1)+(1/2)*(A_d(2,1)*(x1(i-1)+x1(i-d_2-1)+2*(x1(i-2)+x1(i-3)+x1(i-4)))+A_d(2,2)*(x2(i-1)+x2(i-d_2-1)+2*(x2(i-2)+x2(i-3)+x2(i-4)))));
end
end
end
%% Plotting Graphs
figure
grid on
hold on
box on
plot(t,x1(1,:),’-g’,t,x2(1,:),’r-‘,’linewidth’,2.5)
hold on
xlabel(‘Time (t)’)
%ylabel(‘State responses’)
legend(‘x_{1}(t)’,’x_{2}(t)’);
xlim([0,30]);
ylim([-100,100]);
% indexing MATLAB Answers — New Questions
3D simulation engine interface setup timeout.
I am getting this error when i try to run the script in this example Visualize Automated Parking Valet Using Unreal Engine Simulation.
MATLAB System block ‘untitled/Simulation 3D Scene Configuration/Simulation 3D Engine’ error occurred when invoking ‘resetImpl’ method of ‘Simulation3DEngine’. The error was thrown from ‘
‘C:MATLAB2020btoolboxsharedsim3dsim3d+sim3dEngineInterface.p’ at line 0
‘C:MATLAB2020btoolboxsharedsim3dsim3d+sim3dEngine.p’ at line 0
‘C:MATLAB2020btoolboxsharedsim3dsim3d+sim3dProject.p’ at line 0
‘C:MATLAB2020btoolboxsharedsim3dblkssim3dblksSimulation3DEngine.p’ at line 0′.
Caused by:
3D simulation engine interface setup timeout.
Can anyone help me fix this ?I am getting this error when i try to run the script in this example Visualize Automated Parking Valet Using Unreal Engine Simulation.
MATLAB System block ‘untitled/Simulation 3D Scene Configuration/Simulation 3D Engine’ error occurred when invoking ‘resetImpl’ method of ‘Simulation3DEngine’. The error was thrown from ‘
‘C:MATLAB2020btoolboxsharedsim3dsim3d+sim3dEngineInterface.p’ at line 0
‘C:MATLAB2020btoolboxsharedsim3dsim3d+sim3dEngine.p’ at line 0
‘C:MATLAB2020btoolboxsharedsim3dsim3d+sim3dProject.p’ at line 0
‘C:MATLAB2020btoolboxsharedsim3dblkssim3dblksSimulation3DEngine.p’ at line 0′.
Caused by:
3D simulation engine interface setup timeout.
Can anyone help me fix this ? I am getting this error when i try to run the script in this example Visualize Automated Parking Valet Using Unreal Engine Simulation.
MATLAB System block ‘untitled/Simulation 3D Scene Configuration/Simulation 3D Engine’ error occurred when invoking ‘resetImpl’ method of ‘Simulation3DEngine’. The error was thrown from ‘
‘C:MATLAB2020btoolboxsharedsim3dsim3d+sim3dEngineInterface.p’ at line 0
‘C:MATLAB2020btoolboxsharedsim3dsim3d+sim3dEngine.p’ at line 0
‘C:MATLAB2020btoolboxsharedsim3dsim3d+sim3dProject.p’ at line 0
‘C:MATLAB2020btoolboxsharedsim3dblkssim3dblksSimulation3DEngine.p’ at line 0′.
Caused by:
3D simulation engine interface setup timeout.
Can anyone help me fix this ? simulink, automated driving toolbox MATLAB Answers — New Questions
RoadRunner plugins for Unreal 4.26
With the new version R2022a the RoadRunner Plugins should support Unreal4.26 and the .udatasmith format. On the download page it still says RoadRunner Plugins 1.1.0 and in the ReadMe it only says "support Unreal 4.25". Is there a newer version somewhere?
So the chain from RoadRunner to Unreal including co-simulation with Simulink doesn’t seem to work for me anymore.With the new version R2022a the RoadRunner Plugins should support Unreal4.26 and the .udatasmith format. On the download page it still says RoadRunner Plugins 1.1.0 and in the ReadMe it only says "support Unreal 4.25". Is there a newer version somewhere?
So the chain from RoadRunner to Unreal including co-simulation with Simulink doesn’t seem to work for me anymore. With the new version R2022a the RoadRunner Plugins should support Unreal4.26 and the .udatasmith format. On the download page it still says RoadRunner Plugins 1.1.0 and in the ReadMe it only says "support Unreal 4.25". Is there a newer version somewhere?
So the chain from RoadRunner to Unreal including co-simulation with Simulink doesn’t seem to work for me anymore. unreal export, unreal interface MATLAB Answers — New Questions
[MATLAB’s GUI] Erase everything within “Delimiter matching”
Hello,
After coming across this post,
https://stackoverflow.com/questions/72543162/color-parentheses-groups-in-matlabs-ide
I improved a lot my Matlab experience by better seeing the scope of a function, it’s arguments, parenthesis, etc. It’s great.
However, I was wondering if there is a way to setup a hotkey to remove the contents that are highlighthed by such delimiters. I couldn’t find anything online.
In other words, if Matlab is properly highlighting these delimiters (i.e. parenthesis, brackets, IF/END, etc) there must be a way to capture these 2 "endpoints" and just erase everything within it. Maybe some Java hacks which I’m not super familiar with?
I’m using Matlab 2020b and have no intention of changing it anytime soon (because I have custom libraries that stopped being supported) if that changes anything.
Thanks for any input!
LucianoHello,
After coming across this post,
https://stackoverflow.com/questions/72543162/color-parentheses-groups-in-matlabs-ide
I improved a lot my Matlab experience by better seeing the scope of a function, it’s arguments, parenthesis, etc. It’s great.
However, I was wondering if there is a way to setup a hotkey to remove the contents that are highlighthed by such delimiters. I couldn’t find anything online.
In other words, if Matlab is properly highlighting these delimiters (i.e. parenthesis, brackets, IF/END, etc) there must be a way to capture these 2 "endpoints" and just erase everything within it. Maybe some Java hacks which I’m not super familiar with?
I’m using Matlab 2020b and have no intention of changing it anytime soon (because I have custom libraries that stopped being supported) if that changes anything.
Thanks for any input!
Luciano Hello,
After coming across this post,
https://stackoverflow.com/questions/72543162/color-parentheses-groups-in-matlabs-ide
I improved a lot my Matlab experience by better seeing the scope of a function, it’s arguments, parenthesis, etc. It’s great.
However, I was wondering if there is a way to setup a hotkey to remove the contents that are highlighthed by such delimiters. I couldn’t find anything online.
In other words, if Matlab is properly highlighting these delimiters (i.e. parenthesis, brackets, IF/END, etc) there must be a way to capture these 2 "endpoints" and just erase everything within it. Maybe some Java hacks which I’m not super familiar with?
I’m using Matlab 2020b and have no intention of changing it anytime soon (because I have custom libraries that stopped being supported) if that changes anything.
Thanks for any input!
Luciano delimiter matching highlight erase gui hotkey, selective highlighting MATLAB Answers — New Questions
How to export from Mathematica so that Matlab can see a variable name other than Expression1
I’m exporting a variable from Mathematica to disk in .mat format.
Later I want to read this in Matlab.
When I load the .mat file, my variable is called Expression1
How do I export it properly in Mathematica so that my original variable name is preserved?
(I don’t know if this is possible. I can’t find out how to do it when I search the mathematica help files)
Thanks,
TomI’m exporting a variable from Mathematica to disk in .mat format.
Later I want to read this in Matlab.
When I load the .mat file, my variable is called Expression1
How do I export it properly in Mathematica so that my original variable name is preserved?
(I don’t know if this is possible. I can’t find out how to do it when I search the mathematica help files)
Thanks,
Tom I’m exporting a variable from Mathematica to disk in .mat format.
Later I want to read this in Matlab.
When I load the .mat file, my variable is called Expression1
How do I export it properly in Mathematica so that my original variable name is preserved?
(I don’t know if this is possible. I can’t find out how to do it when I search the mathematica help files)
Thanks,
Tom export, load, mathematica, variable name MATLAB Answers — New Questions
Who do I contact to receive a New License/Product or a Renewal Quote?
Who do I contact to receive a New License/Product or a Renewal Quote?Who do I contact to receive a New License/Product or a Renewal Quote? Who do I contact to receive a New License/Product or a Renewal Quote? quote, quotation, inquiry, proforma, invoice, request, 見積, 見積り, renewal MATLAB Answers — New Questions