Category: Matlab
Category Archives: Matlab
Does MATLAB support quadruple precision – 128-bit floating point arithmetics?
I need more precision than offered by the standard double data type in MATLAB. I am looking for a quadruple precision in MATLAB.I need more precision than offered by the standard double data type in MATLAB. I am looking for a quadruple precision in MATLAB. I need more precision than offered by the standard double data type in MATLAB. I am looking for a quadruple precision in MATLAB. 128-bit, quadruple_precision, float, double MATLAB Answers — New Questions
​
Why do I get “Code generation information file does not exist” as the “Rebuild Reason” when building my model?
When I successfully build our model I get "Code generation information file does not exist" as "Rebuild Reason".
Build Summary
Top model targets built:
Model | Action |Rebuild Reason
====================================================================
modelName | Code generated | Code generation information file does not exist.
1 of 1 models built (0 models already up to date)
Why is this and how can I remedy it?When I successfully build our model I get "Code generation information file does not exist" as "Rebuild Reason".
Build Summary
Top model targets built:
Model | Action |Rebuild Reason
====================================================================
modelName | Code generated | Code generation information file does not exist.
1 of 1 models built (0 models already up to date)
Why is this and how can I remedy it? When I successfully build our model I get "Code generation information file does not exist" as "Rebuild Reason".
Build Summary
Top model targets built:
Model | Action |Rebuild Reason
====================================================================
modelName | Code generated | Code generation information file does not exist.
1 of 1 models built (0 models already up to date)
Why is this and how can I remedy it?  MATLAB Answers — New Questions
​
Why do I get the error message “#error Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE” when building a model with an S-function?
I have a Simulink R2018b model which contains an S-function. The S-function is a MEX S-Function. When I try to build the model, I get the following error message:
#error Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE
I am using Visual Studio 2017 as a compiler.I have a Simulink R2018b model which contains an S-function. The S-function is a MEX S-Function. When I try to build the model, I get the following error message:
#error Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE
I am using Visual Studio 2017 as a compiler. I have a Simulink R2018b model which contains an S-function. The S-function is a MEX S-Function. When I try to build the model, I get the following error message:
#error Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE
I am using Visual Studio 2017 as a compiler. external, ide, s-function, error, inlining, tlc, non-lined MATLAB Answers — New Questions
​
Simulate sine wave with timestep different than overall model timestep
Hello All,
I needed your help in understanding of where the mistake is and wanted to know how can I implement the following:
I have a simulink model running a certain fixed time step. And inside the model there is a sine wave function connected with a digital clock that is creating a sine wave with sample rate set to -1(inherit). Meaning it will use t=simulink model timestep. Instead of -1 I would like to use a time step which is faster than Simulink time step. I tried using different values but I am getting an error: "Digital Clock has an invalid sample time. Only constant (inf) or inherited (-1) sample times are allowed in the asynchronous subsystem".
Can you please suggest me what other options can I try?
Appreciate all your help and guidance.Hello All,
I needed your help in understanding of where the mistake is and wanted to know how can I implement the following:
I have a simulink model running a certain fixed time step. And inside the model there is a sine wave function connected with a digital clock that is creating a sine wave with sample rate set to -1(inherit). Meaning it will use t=simulink model timestep. Instead of -1 I would like to use a time step which is faster than Simulink time step. I tried using different values but I am getting an error: "Digital Clock has an invalid sample time. Only constant (inf) or inherited (-1) sample times are allowed in the asynchronous subsystem".
Can you please suggest me what other options can I try?
Appreciate all your help and guidance. Hello All,
I needed your help in understanding of where the mistake is and wanted to know how can I implement the following:
I have a simulink model running a certain fixed time step. And inside the model there is a sine wave function connected with a digital clock that is creating a sine wave with sample rate set to -1(inherit). Meaning it will use t=simulink model timestep. Instead of -1 I would like to use a time step which is faster than Simulink time step. I tried using different values but I am getting an error: "Digital Clock has an invalid sample time. Only constant (inf) or inherited (-1) sample times are allowed in the asynchronous subsystem".
Can you please suggest me what other options can I try?
Appreciate all your help and guidance. #simulink MATLAB Answers — New Questions
​
getting statistics from within a mask within an image
We have an image that represents data that only makes sense when it is analyzed in numerical format.
Specifically, the data needs to be analyzed as a function of radius as shown below
Im interested specifically in hte max and min values within each of the defined areas with respect to the center point.
Ive been looking at a few examples online and it seems this should work when you pull the data from a mask.
However, the issue is that I seem to be getting values that are not realistic.
How to get pixel value inside a circle – MATLAB Answers – MATLAB Central (mathworks.com)
how to draw circle in an image? – MATLAB Answers – MATLAB Central (mathworks.com)
this is what I am doing
clear
img = double(imread(‘img121.jpg’));; %no filtration
img = -(0.0316*img) +8.3; % we did this as we cant calibeate the film, we scan the same film over and over and it changes by 80pixels
img = imrotate(img, 90);
img = imgaussfilt(img ,1.5);
figure, imagesc(img )
axis image
height2 = 3.6
caxis([0 height2])
colorbar
title(‘ ‘)
impixelinfo
%# make sure the image doesn’t disappear if we plot something else
hold on
%https://www.mathworks.com/matlabcentral/answers/1931825-how-to-get-pixel-value-inside-a-circle
%below looks like what we want
%https://www.mathworks.com/matlabcentral/answers/1931825-how-to-get-pixel-value-inside-a-circle
%# define points (in matrix coordinates)
%3"
cpx = 2050;
cpy = 2020;
inchlist = [12,10.5,9,7.5,6,4.5];
%draw lines on heel axis
for n=1:size(inchlist,2)
inch= inchlist(n)/4;
hcirc = drawcircle(‘Center’,[2050,2020],’Radius’,inch*590,’StripeColor’,’red’);
mask1 = hcirc.createMask;
maxval = (max(img(mask1)));
minval = (min(img(mask1)));
uniformity = maxval/minval
% p1 = [cpy-100,cpx+inch*590];
end
Even after getting this max and min value, I will need to remove 10 to get rid of noise. Extra credit if you can point me to a soluton for that too.
thank youWe have an image that represents data that only makes sense when it is analyzed in numerical format.
Specifically, the data needs to be analyzed as a function of radius as shown below
Im interested specifically in hte max and min values within each of the defined areas with respect to the center point.
Ive been looking at a few examples online and it seems this should work when you pull the data from a mask.
However, the issue is that I seem to be getting values that are not realistic.
How to get pixel value inside a circle – MATLAB Answers – MATLAB Central (mathworks.com)
how to draw circle in an image? – MATLAB Answers – MATLAB Central (mathworks.com)
this is what I am doing
clear
img = double(imread(‘img121.jpg’));; %no filtration
img = -(0.0316*img) +8.3; % we did this as we cant calibeate the film, we scan the same film over and over and it changes by 80pixels
img = imrotate(img, 90);
img = imgaussfilt(img ,1.5);
figure, imagesc(img )
axis image
height2 = 3.6
caxis([0 height2])
colorbar
title(‘ ‘)
impixelinfo
%# make sure the image doesn’t disappear if we plot something else
hold on
%https://www.mathworks.com/matlabcentral/answers/1931825-how-to-get-pixel-value-inside-a-circle
%below looks like what we want
%https://www.mathworks.com/matlabcentral/answers/1931825-how-to-get-pixel-value-inside-a-circle
%# define points (in matrix coordinates)
%3"
cpx = 2050;
cpy = 2020;
inchlist = [12,10.5,9,7.5,6,4.5];
%draw lines on heel axis
for n=1:size(inchlist,2)
inch= inchlist(n)/4;
hcirc = drawcircle(‘Center’,[2050,2020],’Radius’,inch*590,’StripeColor’,’red’);
mask1 = hcirc.createMask;
maxval = (max(img(mask1)));
minval = (min(img(mask1)));
uniformity = maxval/minval
% p1 = [cpy-100,cpx+inch*590];
end
Even after getting this max and min value, I will need to remove 10 to get rid of noise. Extra credit if you can point me to a soluton for that too.
thank you We have an image that represents data that only makes sense when it is analyzed in numerical format.
Specifically, the data needs to be analyzed as a function of radius as shown below
Im interested specifically in hte max and min values within each of the defined areas with respect to the center point.
Ive been looking at a few examples online and it seems this should work when you pull the data from a mask.
However, the issue is that I seem to be getting values that are not realistic.
How to get pixel value inside a circle – MATLAB Answers – MATLAB Central (mathworks.com)
how to draw circle in an image? – MATLAB Answers – MATLAB Central (mathworks.com)
this is what I am doing
clear
img = double(imread(‘img121.jpg’));; %no filtration
img = -(0.0316*img) +8.3; % we did this as we cant calibeate the film, we scan the same film over and over and it changes by 80pixels
img = imrotate(img, 90);
img = imgaussfilt(img ,1.5);
figure, imagesc(img )
axis image
height2 = 3.6
caxis([0 height2])
colorbar
title(‘ ‘)
impixelinfo
%# make sure the image doesn’t disappear if we plot something else
hold on
%https://www.mathworks.com/matlabcentral/answers/1931825-how-to-get-pixel-value-inside-a-circle
%below looks like what we want
%https://www.mathworks.com/matlabcentral/answers/1931825-how-to-get-pixel-value-inside-a-circle
%# define points (in matrix coordinates)
%3"
cpx = 2050;
cpy = 2020;
inchlist = [12,10.5,9,7.5,6,4.5];
%draw lines on heel axis
for n=1:size(inchlist,2)
inch= inchlist(n)/4;
hcirc = drawcircle(‘Center’,[2050,2020],’Radius’,inch*590,’StripeColor’,’red’);
mask1 = hcirc.createMask;
maxval = (max(img(mask1)));
minval = (min(img(mask1)));
uniformity = maxval/minval
% p1 = [cpy-100,cpx+inch*590];
end
Even after getting this max and min value, I will need to remove 10 to get rid of noise. Extra credit if you can point me to a soluton for that too.
thank you mask, statistics MATLAB Answers — New Questions
​
How to classify a folder of images?
I have a file contains a set of images including images of three denominations of currency. I need a MATLAB code to determine the number of images for each denomination of currency according to its features and colors.I have a file contains a set of images including images of three denominations of currency. I need a MATLAB code to determine the number of images for each denomination of currency according to its features and colors. I have a file contains a set of images including images of three denominations of currency. I need a MATLAB code to determine the number of images for each denomination of currency according to its features and colors. classify a folder of images MATLAB Answers — New Questions
​
how to modify code for distributed delay
I have a code, which gives a solution of a delay logistic equation with discrete delay.
tau = 1;
tspan = [0 20];
y0 = 0.5;
sol = dde23(@ddefunc, tau, y0, tspan);
% Plot the solution
figure;
plot(sol.x, sol.y, ‘LineWidth’, 2);
xlabel(‘Time (days)’);
ylabel(‘Population’);
legend(‘y’);
% Define the delay differential equation
function g = ddefunc(t, y, Z)
r = 1.5;
y_tau = Z;
g = r * y * (1 – y_tau);
end
Now I want to modify my code for distributed delay as attached below.
Can someone guide me how to deal with distributed delayI have a code, which gives a solution of a delay logistic equation with discrete delay.
tau = 1;
tspan = [0 20];
y0 = 0.5;
sol = dde23(@ddefunc, tau, y0, tspan);
% Plot the solution
figure;
plot(sol.x, sol.y, ‘LineWidth’, 2);
xlabel(‘Time (days)’);
ylabel(‘Population’);
legend(‘y’);
% Define the delay differential equation
function g = ddefunc(t, y, Z)
r = 1.5;
y_tau = Z;
g = r * y * (1 – y_tau);
end
Now I want to modify my code for distributed delay as attached below.
Can someone guide me how to deal with distributed delay I have a code, which gives a solution of a delay logistic equation with discrete delay.
tau = 1;
tspan = [0 20];
y0 = 0.5;
sol = dde23(@ddefunc, tau, y0, tspan);
% Plot the solution
figure;
plot(sol.x, sol.y, ‘LineWidth’, 2);
xlabel(‘Time (days)’);
ylabel(‘Population’);
legend(‘y’);
% Define the delay differential equation
function g = ddefunc(t, y, Z)
r = 1.5;
y_tau = Z;
g = r * y * (1 – y_tau);
end
Now I want to modify my code for distributed delay as attached below.
Can someone guide me how to deal with distributed delay distributed delay, delay differentia equations, solve MATLAB Answers — New Questions
​
Sizeof double float int etc
Hello there,
I need to know how to find an equivallent function in Matlab to the sizeof function in c++.
For example, in c++ if I write sizeof(double) I would get the amount of memory needed to store a double.
I need something very similar with a matrix now. I will be storing bigger and bigger matrix and I need to find their size in the memory.
Could someone of you please help me?
all best,
:)Hello there,
I need to know how to find an equivallent function in Matlab to the sizeof function in c++.
For example, in c++ if I write sizeof(double) I would get the amount of memory needed to store a double.
I need something very similar with a matrix now. I will be storing bigger and bigger matrix and I need to find their size in the memory.
Could someone of you please help me?
all best,
🙂 Hello there,
I need to know how to find an equivallent function in Matlab to the sizeof function in c++.
For example, in c++ if I write sizeof(double) I would get the amount of memory needed to store a double.
I need something very similar with a matrix now. I will be storing bigger and bigger matrix and I need to find their size in the memory.
Could someone of you please help me?
all best,
🙂 sizeof, memory, size MATLAB Answers — New Questions
​
To RESHAPE number of elements must not change
Hi all, im trying to do simple ERP study using EEGLAB. To RESHAPE number of elements must not change, such an error messahe was thrown. let me know how to fix it. ThanksHi all, im trying to do simple ERP study using EEGLAB. To RESHAPE number of elements must not change, such an error messahe was thrown. let me know how to fix it. Thanks Hi all, im trying to do simple ERP study using EEGLAB. To RESHAPE number of elements must not change, such an error messahe was thrown. let me know how to fix it. Thanks please help MATLAB Answers — New Questions
​
How to datasample exponential data without losing the exponential decay?
Hi all!
So this is the question:
I have a Table with one column (std_spk_avg, attached). This column has 400 numbers. The data follow exponential distribution, so when i normally resample using ‘resample’ function in matlab to obtain 1000 iterations, i lose the exponential decay in each iteration…
How can i code with this function so as not to lose the exponential decay in my 1000 iterations?
Thanks you all in advance :)Hi all!
So this is the question:
I have a Table with one column (std_spk_avg, attached). This column has 400 numbers. The data follow exponential distribution, so when i normally resample using ‘resample’ function in matlab to obtain 1000 iterations, i lose the exponential decay in each iteration…
How can i code with this function so as not to lose the exponential decay in my 1000 iterations?
Thanks you all in advance 🙂 Hi all!
So this is the question:
I have a Table with one column (std_spk_avg, attached). This column has 400 numbers. The data follow exponential distribution, so when i normally resample using ‘resample’ function in matlab to obtain 1000 iterations, i lose the exponential decay in each iteration…
How can i code with this function so as not to lose the exponential decay in my 1000 iterations?
Thanks you all in advance 🙂 datasample, exponential, table, exponential data, struct MATLAB Answers — New Questions
​
how to organize input dimensions for LSTM classification
Hi guys,
I’m trying to train a lstm using sequential data to predict classes, and I’m a little confused by the format of input data and labels.
For the sake of simplicity, I’ll use an example to mimic my situation.
let’s say I’m trying to use temperature data to predict 3 cities: A, B, and C.
Within each city, i have temperature readings from 10 therometers over 2 seconds at a sample frequency of 100 hz.
So far, at each observation, I have a 200 by 10 matrix (time point by therometer).
temperature_matrix = randi(40, 200, 10) % pseudodata
We collected the temperature data 40 times throughout the day at each city, and this will give us 120 observations (3 cities * 40). Within each observation, I have a 200 by 10 matrix.
As for my input format, I now have a 120 by 1 cell array, and again within each cell array is a 200 by 10 matrix.
temperature_input = cell(120,1)
for ii = 1:length(temperature_input)
temperature_input{ii} = randi(40, 200, 10)
end
labels = [repmat("city A", 40,1); repmat("city B", 40,1); repmat("city C", 40,1)]
Per my undstanding, if I were to have a time step of 10, i should make a sliding window with a size of 5, and move it down the time dimenssion at a moving step of 1. That is to say, for each 200 by 10 temperature_matrix, I now slice it into 196 2D arrays, where each array is 5 by 10 (window size by therometer).
My question is how this sliding window plays a part in the input format? the sliding window create the fourth dimension in my example. The other three dimension is observation, time, and therometer. I think my overall structure is still a 120 by 1 cell array, but the dimenssions within each entry, I dont know how to organize them.
Also, out of curiosity, will it mess up the structure i transpose the time point by therometer matrice? I’m only asking between I’ve seen examples on the sequencce either in row or column.
Best,
FYHi guys,
I’m trying to train a lstm using sequential data to predict classes, and I’m a little confused by the format of input data and labels.
For the sake of simplicity, I’ll use an example to mimic my situation.
let’s say I’m trying to use temperature data to predict 3 cities: A, B, and C.
Within each city, i have temperature readings from 10 therometers over 2 seconds at a sample frequency of 100 hz.
So far, at each observation, I have a 200 by 10 matrix (time point by therometer).
temperature_matrix = randi(40, 200, 10) % pseudodata
We collected the temperature data 40 times throughout the day at each city, and this will give us 120 observations (3 cities * 40). Within each observation, I have a 200 by 10 matrix.
As for my input format, I now have a 120 by 1 cell array, and again within each cell array is a 200 by 10 matrix.
temperature_input = cell(120,1)
for ii = 1:length(temperature_input)
temperature_input{ii} = randi(40, 200, 10)
end
labels = [repmat("city A", 40,1); repmat("city B", 40,1); repmat("city C", 40,1)]
Per my undstanding, if I were to have a time step of 10, i should make a sliding window with a size of 5, and move it down the time dimenssion at a moving step of 1. That is to say, for each 200 by 10 temperature_matrix, I now slice it into 196 2D arrays, where each array is 5 by 10 (window size by therometer).
My question is how this sliding window plays a part in the input format? the sliding window create the fourth dimension in my example. The other three dimension is observation, time, and therometer. I think my overall structure is still a 120 by 1 cell array, but the dimenssions within each entry, I dont know how to organize them.
Also, out of curiosity, will it mess up the structure i transpose the time point by therometer matrice? I’m only asking between I’ve seen examples on the sequencce either in row or column.
Best,
FYÂ Hi guys,
I’m trying to train a lstm using sequential data to predict classes, and I’m a little confused by the format of input data and labels.
For the sake of simplicity, I’ll use an example to mimic my situation.
let’s say I’m trying to use temperature data to predict 3 cities: A, B, and C.
Within each city, i have temperature readings from 10 therometers over 2 seconds at a sample frequency of 100 hz.
So far, at each observation, I have a 200 by 10 matrix (time point by therometer).
temperature_matrix = randi(40, 200, 10) % pseudodata
We collected the temperature data 40 times throughout the day at each city, and this will give us 120 observations (3 cities * 40). Within each observation, I have a 200 by 10 matrix.
As for my input format, I now have a 120 by 1 cell array, and again within each cell array is a 200 by 10 matrix.
temperature_input = cell(120,1)
for ii = 1:length(temperature_input)
temperature_input{ii} = randi(40, 200, 10)
end
labels = [repmat("city A", 40,1); repmat("city B", 40,1); repmat("city C", 40,1)]
Per my undstanding, if I were to have a time step of 10, i should make a sliding window with a size of 5, and move it down the time dimenssion at a moving step of 1. That is to say, for each 200 by 10 temperature_matrix, I now slice it into 196 2D arrays, where each array is 5 by 10 (window size by therometer).
My question is how this sliding window plays a part in the input format? the sliding window create the fourth dimension in my example. The other three dimension is observation, time, and therometer. I think my overall structure is still a 120 by 1 cell array, but the dimenssions within each entry, I dont know how to organize them.
Also, out of curiosity, will it mess up the structure i transpose the time point by therometer matrice? I’m only asking between I’ve seen examples on the sequencce either in row or column.
Best,
FY lstm, input, dimension MATLAB Answers — New Questions
​
How to create a component reference in the system composer from a simscape component
Hello,
I have a Simscape Isothermal Fluid component that is an isolated component (it have its own test harness, test cases and requirements. You can see it is composed with simscape signals and simulink signals.
I would like to build a system composer, were this component is part of. But when I add a "reference component" on the system composer ad link to the compoenent, the physical lines does not come.
The only way I made it works is creating the sismcape compoenent inside the system composer, but this way I need to manage changes and so on inside the composer.
Any solution to create a simscape component that can be referenced inside the system composer and have the physical connections available?Hello,
I have a Simscape Isothermal Fluid component that is an isolated component (it have its own test harness, test cases and requirements. You can see it is composed with simscape signals and simulink signals.
I would like to build a system composer, were this component is part of. But when I add a "reference component" on the system composer ad link to the compoenent, the physical lines does not come.
The only way I made it works is creating the sismcape compoenent inside the system composer, but this way I need to manage changes and so on inside the composer.
Any solution to create a simscape component that can be referenced inside the system composer and have the physical connections available? Hello,
I have a Simscape Isothermal Fluid component that is an isolated component (it have its own test harness, test cases and requirements. You can see it is composed with simscape signals and simulink signals.
I would like to build a system composer, were this component is part of. But when I add a "reference component" on the system composer ad link to the compoenent, the physical lines does not come.
The only way I made it works is creating the sismcape compoenent inside the system composer, but this way I need to manage changes and so on inside the composer.
Any solution to create a simscape component that can be referenced inside the system composer and have the physical connections available? simscape, system composer MATLAB Answers — New Questions
​
In Simulink, How to decode CAN data with length greater than 8?
There is an issue using CAN Unpack to decode CAN message with length greater than 8. Is there any other recommanded way to decode CAN data? For starter, I have used bit extract and bitwise AND Shift Arithmetic to extract bits in simulink. I’m not sure if matlab function in simulink can also handle this if it’s possible.There is an issue using CAN Unpack to decode CAN message with length greater than 8. Is there any other recommanded way to decode CAN data? For starter, I have used bit extract and bitwise AND Shift Arithmetic to extract bits in simulink. I’m not sure if matlab function in simulink can also handle this if it’s possible. There is an issue using CAN Unpack to decode CAN message with length greater than 8. Is there any other recommanded way to decode CAN data? For starter, I have used bit extract and bitwise AND Shift Arithmetic to extract bits in simulink. I’m not sure if matlab function in simulink can also handle this if it’s possible. data, control MATLAB Answers — New Questions
​
Why do I get an invalid Python executable path error when running the “pyenv” function?
Previously I was able to use the "pyenv" function in MATLAB with my Python environment. However, now when I try to use the "pyenv" function, I get the following error message. Why am I suddenly receiving this error?
Â
Error using pyenv
‘<path>’ is not a path to a valid Python executable.Previously I was able to use the "pyenv" function in MATLAB with my Python environment. However, now when I try to use the "pyenv" function, I get the following error message. Why am I suddenly receiving this error?
Â
Error using pyenv
‘<path>’ is not a path to a valid Python executable. Previously I was able to use the "pyenv" function in MATLAB with my Python environment. However, now when I try to use the "pyenv" function, I get the following error message. Why am I suddenly receiving this error?
Â
Error using pyenv
‘<path>’ is not a path to a valid Python executable. python, pyenv MATLAB Answers — New Questions
​
Finding the closest coordinate from a surface plot based on a X, Y location
Hello, I want to extrapolate a point (longitude,latitude) from the coordinates of a surface file (attached here as "slab_strike") as it is empty (Strike=NaN) when using interp2 as the points are outside the boundary. Despsite I used the option "nearest" is empty anyway.
% Coordinates of the points:
lat_GMM= -17.8990;
lon_GMM=-73.5295;
% The surface plot
load slab_strike % Loading the slab strike
Slab_strike.x=x
Slab_strike.y=y
Slab_strike.z=z
Strike = interp2(Slab_strike.x,Slab_strike.y,Slab_strike.z,lon_GMM,lat_GMM)
As Strike=NaN, there is a way I can choose the closest point value from the surface instead.
I would appreciate the helpHello, I want to extrapolate a point (longitude,latitude) from the coordinates of a surface file (attached here as "slab_strike") as it is empty (Strike=NaN) when using interp2 as the points are outside the boundary. Despsite I used the option "nearest" is empty anyway.
% Coordinates of the points:
lat_GMM= -17.8990;
lon_GMM=-73.5295;
% The surface plot
load slab_strike % Loading the slab strike
Slab_strike.x=x
Slab_strike.y=y
Slab_strike.z=z
Strike = interp2(Slab_strike.x,Slab_strike.y,Slab_strike.z,lon_GMM,lat_GMM)
As Strike=NaN, there is a way I can choose the closest point value from the surface instead.
I would appreciate the help Hello, I want to extrapolate a point (longitude,latitude) from the coordinates of a surface file (attached here as "slab_strike") as it is empty (Strike=NaN) when using interp2 as the points are outside the boundary. Despsite I used the option "nearest" is empty anyway.
% Coordinates of the points:
lat_GMM= -17.8990;
lon_GMM=-73.5295;
% The surface plot
load slab_strike % Loading the slab strike
Slab_strike.x=x
Slab_strike.y=y
Slab_strike.z=z
Strike = interp2(Slab_strike.x,Slab_strike.y,Slab_strike.z,lon_GMM,lat_GMM)
As Strike=NaN, there is a way I can choose the closest point value from the surface instead.
I would appreciate the help selecting the closest point reference MATLAB Answers — New Questions
​
Issue connecting Simulink to Arduino Nano 33 IoT
I’m having an issue connecting my Arduino Nano 33 IoT to simulink. When I try to run it, I get the error message: "Unrecognized feild name " HostCOMPort" " I’m unsure how to resolve this and would greatly appricate the help!
The device shows up in my device manager and I can run code in Arduino IDE and Matlab without issues. Its only when I use Simulink is there a problem. Im using the cable that came in the Engineering Rev 2 kit from Arduino as well as a usb to usb-c converter to plug into my surface go to connect my computer to the Nano. I am able to run a regular Arduino Uno using the same setup through simiulink.
I’ve notcied that everytime I try to run the simulink program, the port in the device manager will change from "Arduino Nano 33 IoT" to the bootloader version. And also Matlab will tell me that an arduino device is detected again. My guess is that the Nano is restarting everytime or something? Im not really sure.I’m having an issue connecting my Arduino Nano 33 IoT to simulink. When I try to run it, I get the error message: "Unrecognized feild name " HostCOMPort" " I’m unsure how to resolve this and would greatly appricate the help!
The device shows up in my device manager and I can run code in Arduino IDE and Matlab without issues. Its only when I use Simulink is there a problem. Im using the cable that came in the Engineering Rev 2 kit from Arduino as well as a usb to usb-c converter to plug into my surface go to connect my computer to the Nano. I am able to run a regular Arduino Uno using the same setup through simiulink.
I’ve notcied that everytime I try to run the simulink program, the port in the device manager will change from "Arduino Nano 33 IoT" to the bootloader version. And also Matlab will tell me that an arduino device is detected again. My guess is that the Nano is restarting everytime or something? Im not really sure. I’m having an issue connecting my Arduino Nano 33 IoT to simulink. When I try to run it, I get the error message: "Unrecognized feild name " HostCOMPort" " I’m unsure how to resolve this and would greatly appricate the help!
The device shows up in my device manager and I can run code in Arduino IDE and Matlab without issues. Its only when I use Simulink is there a problem. Im using the cable that came in the Engineering Rev 2 kit from Arduino as well as a usb to usb-c converter to plug into my surface go to connect my computer to the Nano. I am able to run a regular Arduino Uno using the same setup through simiulink.
I’ve notcied that everytime I try to run the simulink program, the port in the device manager will change from "Arduino Nano 33 IoT" to the bootloader version. And also Matlab will tell me that an arduino device is detected again. My guess is that the Nano is restarting everytime or something? Im not really sure. simulink, arduino, nano MATLAB Answers — New Questions
​
How can I create an offset of a boundary?
How can I create an offset of a boundary?
rng(‘default’)
x = rand(30,1);
y = rand(30,1);
plot(x,y,’.’)
xlim([-0.2 1.2])
ylim([-0.2 1.2])
k = boundary(x,y);
hold on;
plot(x(k),y(k));
My desired output:How can I create an offset of a boundary?
rng(‘default’)
x = rand(30,1);
y = rand(30,1);
plot(x,y,’.’)
xlim([-0.2 1.2])
ylim([-0.2 1.2])
k = boundary(x,y);
hold on;
plot(x(k),y(k));
My desired output:Â How can I create an offset of a boundary?
rng(‘default’)
x = rand(30,1);
y = rand(30,1);
plot(x,y,’.’)
xlim([-0.2 1.2])
ylim([-0.2 1.2])
k = boundary(x,y);
hold on;
plot(x(k),y(k));
My desired output: offset, boundary MATLAB Answers — New Questions
​
How can I control the output data type of the “Signal Editor” block?
How can I control the output data type of the "Signal Editor" block?How can I control the output data type of the "Signal Editor" block? How can I control the output data type of the "Signal Editor" block? signal, editor, simulink, data, types, mat, file, output MATLAB Answers — New Questions
​
How i get a graph that i attached here with this matlab code?
function HTP()
clc
clear all format long % hybrid Carreau
% Define constants
J1 = 0.1;
J2 = 0.1;
J3 = 0.1;
J4 = 0.1;
JS = 0.1;
z = 0.1;
S = 0.1;
GC = 0.1;
Gr = 0.1;
H = 0.1;
a = 0.1;
m = 1;
G = 0.5;
phi = 0.1;
% Define time vector
t = linspace(0, 5, 100); % 100 points between 0 and 5
%t= 1;
% Calculate u1 and u2
u1 = exp(-t) – 1;
% Compute u2 with corrected parentheses and mathematical operations
exp_t = exp(t); % Compute exp(t) once for efficiency
term1 = -33 / J1 * (1 – exp_t – z / 3 * S);
term2 = 2 * GC * J3 + 2 * Gr * J2;
term3 = (2 * J4 * H * a^2) / (1 + m^2);
term4 = 3 * G * exp_t + 6 * exp_t / ((1 – phi)^2.5);
term5 = 2 * GC * JS * exp_t + 2 * Gr * J2 * exp_t;
u2 = (term1 + term2 – term3 – term4 – term5 + term3 * (exp_t – m + m * exp_t)) / (6 * a);
% Compute u
y = 1; % Define y as 1 or another constant value; adjust as needed
u = u1 * y + u2 * y.^2;
% Plot the result
phi = 0.1
figure ;
plot(t, u);
phi= 0.2
figure ;
plot(t, u);
phi = 0.3
figure ;
plot(t, u);
phi = 0.4
figure ;
plot(t, u);
xlabel(‘Time (t)’);
ylabel(‘u(t)’);
title(‘Plot of u(t)’);
axis([0 5 min(u) max(u)]);
grid on;
endfunction HTP()
clc
clear all format long % hybrid Carreau
% Define constants
J1 = 0.1;
J2 = 0.1;
J3 = 0.1;
J4 = 0.1;
JS = 0.1;
z = 0.1;
S = 0.1;
GC = 0.1;
Gr = 0.1;
H = 0.1;
a = 0.1;
m = 1;
G = 0.5;
phi = 0.1;
% Define time vector
t = linspace(0, 5, 100); % 100 points between 0 and 5
%t= 1;
% Calculate u1 and u2
u1 = exp(-t) – 1;
% Compute u2 with corrected parentheses and mathematical operations
exp_t = exp(t); % Compute exp(t) once for efficiency
term1 = -33 / J1 * (1 – exp_t – z / 3 * S);
term2 = 2 * GC * J3 + 2 * Gr * J2;
term3 = (2 * J4 * H * a^2) / (1 + m^2);
term4 = 3 * G * exp_t + 6 * exp_t / ((1 – phi)^2.5);
term5 = 2 * GC * JS * exp_t + 2 * Gr * J2 * exp_t;
u2 = (term1 + term2 – term3 – term4 – term5 + term3 * (exp_t – m + m * exp_t)) / (6 * a);
% Compute u
y = 1; % Define y as 1 or another constant value; adjust as needed
u = u1 * y + u2 * y.^2;
% Plot the result
phi = 0.1
figure ;
plot(t, u);
phi= 0.2
figure ;
plot(t, u);
phi = 0.3
figure ;
plot(t, u);
phi = 0.4
figure ;
plot(t, u);
xlabel(‘Time (t)’);
ylabel(‘u(t)’);
title(‘Plot of u(t)’);
axis([0 5 min(u) max(u)]);
grid on;
end function HTP()
clc
clear all format long % hybrid Carreau
% Define constants
J1 = 0.1;
J2 = 0.1;
J3 = 0.1;
J4 = 0.1;
JS = 0.1;
z = 0.1;
S = 0.1;
GC = 0.1;
Gr = 0.1;
H = 0.1;
a = 0.1;
m = 1;
G = 0.5;
phi = 0.1;
% Define time vector
t = linspace(0, 5, 100); % 100 points between 0 and 5
%t= 1;
% Calculate u1 and u2
u1 = exp(-t) – 1;
% Compute u2 with corrected parentheses and mathematical operations
exp_t = exp(t); % Compute exp(t) once for efficiency
term1 = -33 / J1 * (1 – exp_t – z / 3 * S);
term2 = 2 * GC * J3 + 2 * Gr * J2;
term3 = (2 * J4 * H * a^2) / (1 + m^2);
term4 = 3 * G * exp_t + 6 * exp_t / ((1 – phi)^2.5);
term5 = 2 * GC * JS * exp_t + 2 * Gr * J2 * exp_t;
u2 = (term1 + term2 – term3 – term4 – term5 + term3 * (exp_t – m + m * exp_t)) / (6 * a);
% Compute u
y = 1; % Define y as 1 or another constant value; adjust as needed
u = u1 * y + u2 * y.^2;
% Plot the result
phi = 0.1
figure ;
plot(t, u);
phi= 0.2
figure ;
plot(t, u);
phi = 0.3
figure ;
plot(t, u);
phi = 0.4
figure ;
plot(t, u);
xlabel(‘Time (t)’);
ylabel(‘u(t)’);
title(‘Plot of u(t)’);
axis([0 5 min(u) max(u)]);
grid on;
end multiple lines in one graph MATLAB Answers — New Questions
​
write a function called tri_area returns the area of a triangle with base b and height h
hello this is my function code and command window code and there is a message of invalid expression at line 2 and i dont know what is the wrong can anyone help me
function [area] = tri_area([b,h]);
tri_area([b,h])=(0.5)*(b)*(h)
area=tri_area([b,h])
end
%command window
area = tri_area[3,2])hello this is my function code and command window code and there is a message of invalid expression at line 2 and i dont know what is the wrong can anyone help me
function [area] = tri_area([b,h]);
tri_area([b,h])=(0.5)*(b)*(h)
area=tri_area([b,h])
end
%command window
area = tri_area[3,2])Â hello this is my function code and command window code and there is a message of invalid expression at line 2 and i dont know what is the wrong can anyone help me
function [area] = tri_area([b,h]);
tri_area([b,h])=(0.5)*(b)*(h)
area=tri_area([b,h])
end
%command window
area = tri_area[3,2]) matlab function, homework MATLAB Answers — New Questions
​