Category: Matlab
Category Archives: Matlab
How to import result data from OpenFOAM to matlab?
hello,
I want to import the result data from OpenFOAM which are compressed to matlab to plot the results and compare them with the results of other flow models. Can anyone please help me with the code?
Regards,
Mahendrahello,
I want to import the result data from OpenFOAM which are compressed to matlab to plot the results and compare them with the results of other flow models. Can anyone please help me with the code?
Regards,
Mahendra hello,
I want to import the result data from OpenFOAM which are compressed to matlab to plot the results and compare them with the results of other flow models. Can anyone please help me with the code?
Regards,
Mahendra data import, zip file import, data import fromopenfoam to matlab MATLAB Answers — New Questions
Integrating Simulink with OpenFOAM.
Is there any way of integrating Simulink with OpenFOAM (e.g. having an engine model in the first and a propeller model in the second)?Is there any way of integrating Simulink with OpenFOAM (e.g. having an engine model in the first and a propeller model in the second)? Is there any way of integrating Simulink with OpenFOAM (e.g. having an engine model in the first and a propeller model in the second)? simulink, openfoam, integration, matlab, communication MATLAB Answers — New Questions
Why do I receive a privimporthdl error when importing the operator.vhd example
Hello,
I am trying to import a VHDL file using the operator.vhd example. However, I receive the following error when using the importhdl function.
I beleive I have followed the example correctly, but I am at a loss as to why this is occuring. Is this a problem experienced by others at all? I’m not sure what I can try next.
Below is the operator.vhd code when it is opened within the MATLAB editor.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Operator is
Port ( A : in STD_LOGIC_VECTOR(3 downto 0);
B : in STD_LOGIC_VECTOR(3 downto 0);
OpSelect : in STD_LOGIC_VECTOR(2 downto 0);
Result : out STD_LOGIC_VECTOR(3 downto 0));
end Operator;
architecture Behavioral of Operator is
begin
process(A, B, OpSelect)
begin
case OpSelect is
when "000" => — Addition
Result <= A + B;
when "001" => — Subtraction
Result <= A – B;
when "010" => — Bitwise AND
Result <= A and B;
when "011" => — Bitwise OR
Result <= A or B;
when "100" => — Bitwise XOR
Result <= A xor B;
when others => — Default case
Result <= not (A + B);
end case;
end process;
end Behavioral;Hello,
I am trying to import a VHDL file using the operator.vhd example. However, I receive the following error when using the importhdl function.
I beleive I have followed the example correctly, but I am at a loss as to why this is occuring. Is this a problem experienced by others at all? I’m not sure what I can try next.
Below is the operator.vhd code when it is opened within the MATLAB editor.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Operator is
Port ( A : in STD_LOGIC_VECTOR(3 downto 0);
B : in STD_LOGIC_VECTOR(3 downto 0);
OpSelect : in STD_LOGIC_VECTOR(2 downto 0);
Result : out STD_LOGIC_VECTOR(3 downto 0));
end Operator;
architecture Behavioral of Operator is
begin
process(A, B, OpSelect)
begin
case OpSelect is
when "000" => — Addition
Result <= A + B;
when "001" => — Subtraction
Result <= A – B;
when "010" => — Bitwise AND
Result <= A and B;
when "011" => — Bitwise OR
Result <= A or B;
when "100" => — Bitwise XOR
Result <= A xor B;
when others => — Default case
Result <= not (A + B);
end case;
end process;
end Behavioral; Hello,
I am trying to import a VHDL file using the operator.vhd example. However, I receive the following error when using the importhdl function.
I beleive I have followed the example correctly, but I am at a loss as to why this is occuring. Is this a problem experienced by others at all? I’m not sure what I can try next.
Below is the operator.vhd code when it is opened within the MATLAB editor.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Operator is
Port ( A : in STD_LOGIC_VECTOR(3 downto 0);
B : in STD_LOGIC_VECTOR(3 downto 0);
OpSelect : in STD_LOGIC_VECTOR(2 downto 0);
Result : out STD_LOGIC_VECTOR(3 downto 0));
end Operator;
architecture Behavioral of Operator is
begin
process(A, B, OpSelect)
begin
case OpSelect is
when "000" => — Addition
Result <= A + B;
when "001" => — Subtraction
Result <= A – B;
when "010" => — Bitwise AND
Result <= A and B;
when "011" => — Bitwise OR
Result <= A or B;
when "100" => — Bitwise XOR
Result <= A xor B;
when others => — Default case
Result <= not (A + B);
end case;
end process;
end Behavioral; importhdl MATLAB Answers — New Questions
MATLAB ANALYSIS run Successfully on ThingSpeak, BUT always generates Server Error 500, so doesn’t send email
The error is:
"Failed to send alert: The server returned the status 500 with message "Internal Server Error" in response to the request to URL https://api.thingspeak.com/alerts/send."
The message says MATLAB Analysis ran successfully, so the code is good, but never sends the email because of the server error.
Simple code from examples:
% Catch errors so the MATLAB code does not disable a TimeControl if it fails
try
webwrite(alertUrl , "body", alertBody, "subject", alertSubject, options);
catch someException
fprintf("Failed to send alert: %sn", someException.message);
end
Where to go from here?The error is:
"Failed to send alert: The server returned the status 500 with message "Internal Server Error" in response to the request to URL https://api.thingspeak.com/alerts/send."
The message says MATLAB Analysis ran successfully, so the code is good, but never sends the email because of the server error.
Simple code from examples:
% Catch errors so the MATLAB code does not disable a TimeControl if it fails
try
webwrite(alertUrl , "body", alertBody, "subject", alertSubject, options);
catch someException
fprintf("Failed to send alert: %sn", someException.message);
end
Where to go from here? The error is:
"Failed to send alert: The server returned the status 500 with message "Internal Server Error" in response to the request to URL https://api.thingspeak.com/alerts/send."
The message says MATLAB Analysis ran successfully, so the code is good, but never sends the email because of the server error.
Simple code from examples:
% Catch errors so the MATLAB code does not disable a TimeControl if it fails
try
webwrite(alertUrl , "body", alertBody, "subject", alertSubject, options);
catch someException
fprintf("Failed to send alert: %sn", someException.message);
end
Where to go from here? thingspeak MATLAB Answers — New Questions
Hi, does anyone know how to generate the graph as shown below based on a torus? Thank you so much.
Post Content Post Content torus MATLAB Answers — New Questions
For loop won’t display all 10 images in the subplot
%% 1.1 – Load and Prepare Data Set
clear;
clc;
B = load(‘images.mat’).image_data’; % Loads image file and transposes
C = mat2gray(B); % Converts images to grayscale
% Loop to generate and display images
for i = 1:10
im = reshape(C(:,i), [37, 50])’; % Reshape and store the image
subplot(10, 1, i); % Create a 10×1 grid of subplots
imshow(im, []); % Display each image with scaling
end
The above turns the colunms of a correctly sized matrix into images. When run I’m only getting 9 images of the neccessary 10. I’m thinking there’s some quirk where the firs column isn’t running but I’m unsure. I’m running it in matlab live in a browser window.%% 1.1 – Load and Prepare Data Set
clear;
clc;
B = load(‘images.mat’).image_data’; % Loads image file and transposes
C = mat2gray(B); % Converts images to grayscale
% Loop to generate and display images
for i = 1:10
im = reshape(C(:,i), [37, 50])’; % Reshape and store the image
subplot(10, 1, i); % Create a 10×1 grid of subplots
imshow(im, []); % Display each image with scaling
end
The above turns the colunms of a correctly sized matrix into images. When run I’m only getting 9 images of the neccessary 10. I’m thinking there’s some quirk where the firs column isn’t running but I’m unsure. I’m running it in matlab live in a browser window. %% 1.1 – Load and Prepare Data Set
clear;
clc;
B = load(‘images.mat’).image_data’; % Loads image file and transposes
C = mat2gray(B); % Converts images to grayscale
% Loop to generate and display images
for i = 1:10
im = reshape(C(:,i), [37, 50])’; % Reshape and store the image
subplot(10, 1, i); % Create a 10×1 grid of subplots
imshow(im, []); % Display each image with scaling
end
The above turns the colunms of a correctly sized matrix into images. When run I’m only getting 9 images of the neccessary 10. I’m thinking there’s some quirk where the firs column isn’t running but I’m unsure. I’m running it in matlab live in a browser window. for loop MATLAB Answers — New Questions
How to convert two nested for-loops to one parfor loop.
I have the following code. I want to get it in one parfor loop.
clear; clc;
% number of points:
Nx = 80;
Ny = 90;
xs = linspace(-2*pi/(3),4*pi/(3),Nx);
ys = linspace(-2*pi/(sqrt(3)),2*pi/(sqrt(3)),Ny);
% Allocate memory
ZZ = zeros(Nx,Ny,8);
XX = zeros(Nx,Ny);
YY = zeros(Nx,Ny);
for ix = 1:Nx
x = xs(ix);
for iy = 1:Ny
y = ys(iy);
FUN = fun(x,y);
% sort eigenvalues:
[~,D] = eig(FUN);
[D,I] = sort(diag(real(D)),’descend’);
evals = diag(D);
% store data:
ZZ(ix,iy,:) = diag(evals);
XX(ix,iy) = x;
YY(ix,iy) = y;
end
end
%% Plot figure
figure;
tiled = tiledlayout(2,2,"TileSpacing","tight","Padding","compact");
for q = 1:2:8
nexttile
surf(XX,YY,ZZ(:,:,q),’LineStyle’,’none’,’FaceColor’,’interp’);
view(2)
axis([-2*pi/(3) 4*pi/(3) -2*pi/(sqrt(3)) +2*pi/(sqrt(3))])
box on
grid off
axis square
colorbar
end
%%
function out = fun(x,y)
out = [ 3, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0
0, -3, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5
– 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, -1, -2*2^(1/2), – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0
0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, -2*2^(1/2), 1, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5
– 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, -1, 2^(1/2) – 6^(1/2)*1i, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0
0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 2^(1/2) + 6^(1/2)*1i, 1, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5
– 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, -1, 2^(1/2) + 6^(1/2)*1i
0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 2^(1/2) – 6^(1/2)*1i, 1
];
endI have the following code. I want to get it in one parfor loop.
clear; clc;
% number of points:
Nx = 80;
Ny = 90;
xs = linspace(-2*pi/(3),4*pi/(3),Nx);
ys = linspace(-2*pi/(sqrt(3)),2*pi/(sqrt(3)),Ny);
% Allocate memory
ZZ = zeros(Nx,Ny,8);
XX = zeros(Nx,Ny);
YY = zeros(Nx,Ny);
for ix = 1:Nx
x = xs(ix);
for iy = 1:Ny
y = ys(iy);
FUN = fun(x,y);
% sort eigenvalues:
[~,D] = eig(FUN);
[D,I] = sort(diag(real(D)),’descend’);
evals = diag(D);
% store data:
ZZ(ix,iy,:) = diag(evals);
XX(ix,iy) = x;
YY(ix,iy) = y;
end
end
%% Plot figure
figure;
tiled = tiledlayout(2,2,"TileSpacing","tight","Padding","compact");
for q = 1:2:8
nexttile
surf(XX,YY,ZZ(:,:,q),’LineStyle’,’none’,’FaceColor’,’interp’);
view(2)
axis([-2*pi/(3) 4*pi/(3) -2*pi/(sqrt(3)) +2*pi/(sqrt(3))])
box on
grid off
axis square
colorbar
end
%%
function out = fun(x,y)
out = [ 3, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0
0, -3, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5
– 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, -1, -2*2^(1/2), – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0
0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, -2*2^(1/2), 1, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5
– 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, -1, 2^(1/2) – 6^(1/2)*1i, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0
0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 2^(1/2) + 6^(1/2)*1i, 1, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5
– 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, -1, 2^(1/2) + 6^(1/2)*1i
0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 2^(1/2) – 6^(1/2)*1i, 1
];
end I have the following code. I want to get it in one parfor loop.
clear; clc;
% number of points:
Nx = 80;
Ny = 90;
xs = linspace(-2*pi/(3),4*pi/(3),Nx);
ys = linspace(-2*pi/(sqrt(3)),2*pi/(sqrt(3)),Ny);
% Allocate memory
ZZ = zeros(Nx,Ny,8);
XX = zeros(Nx,Ny);
YY = zeros(Nx,Ny);
for ix = 1:Nx
x = xs(ix);
for iy = 1:Ny
y = ys(iy);
FUN = fun(x,y);
% sort eigenvalues:
[~,D] = eig(FUN);
[D,I] = sort(diag(real(D)),’descend’);
evals = diag(D);
% store data:
ZZ(ix,iy,:) = diag(evals);
XX(ix,iy) = x;
YY(ix,iy) = y;
end
end
%% Plot figure
figure;
tiled = tiledlayout(2,2,"TileSpacing","tight","Padding","compact");
for q = 1:2:8
nexttile
surf(XX,YY,ZZ(:,:,q),’LineStyle’,’none’,’FaceColor’,’interp’);
view(2)
axis([-2*pi/(3) 4*pi/(3) -2*pi/(sqrt(3)) +2*pi/(sqrt(3))])
box on
grid off
axis square
colorbar
end
%%
function out = fun(x,y)
out = [ 3, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0
0, -3, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5
– 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, -1, -2*2^(1/2), – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0
0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, -2*2^(1/2), 1, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5
– 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, -1, 2^(1/2) – 6^(1/2)*1i, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0
0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 2^(1/2) + 6^(1/2)*1i, 1, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5
– 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 0, -1, 2^(1/2) + 6^(1/2)*1i
0, – 2*cos(x/2) – (3*cos((3^(1/2)*y)/2))/5, 0, – 2*cos(x/4 – (3^(1/2)*y)/4) – (3*cos((3*x)/4 + (3^(1/2)*y)/4))/5, 0, – 2*cos(x/4 + (3^(1/2)*y)/4) – (3*cos((3*x)/4 – (3^(1/2)*y)/4))/5, 2^(1/2) – 6^(1/2)*1i, 1
];
end parfor MATLAB Answers — New Questions
Write a code in Matlab to generate a realistic synthetic ECG signal (which includes the noise aspect) , demonstrate Visualization of the signal in both the time and frequency
It must include the noise aspect, can l have a sample of the codeIt must include the noise aspect, can l have a sample of the code It must include the noise aspect, can l have a sample of the code kz MATLAB Answers — New Questions
JSON Syntax Error in Simulink Arduino Setup with Flatpak
On NixOS (glnxa64), when I have Flatpak enabled, I will receive an error from the following:
Install Simulink Support Package for Arduino Hardware add-on
Start Hardware Setup wizard in said add-on
Get to the stage where the wizard prompts me to Connect an Arduino Board and is detecting boards
Receive error "JSON syntax error at line 1 (character 1), expected ‘false’ but found ‘flatpak’"
There seem to be no log created for this error (or for the Hardware Setup wizard in general), so it’s been difficult for me to debug the exact reason that this is occuring.
The only way I’ve found to work around this error is to remove Flatpak from my system during Hardware Setup, and re-enable it later. Though there is no guarantee that Arduino support in Simulink will continue to work after I’ve re-enabled Flatpak (I’ve not tested), so I thought it’s important nevertheless for me to raise this issue.On NixOS (glnxa64), when I have Flatpak enabled, I will receive an error from the following:
Install Simulink Support Package for Arduino Hardware add-on
Start Hardware Setup wizard in said add-on
Get to the stage where the wizard prompts me to Connect an Arduino Board and is detecting boards
Receive error "JSON syntax error at line 1 (character 1), expected ‘false’ but found ‘flatpak’"
There seem to be no log created for this error (or for the Hardware Setup wizard in general), so it’s been difficult for me to debug the exact reason that this is occuring.
The only way I’ve found to work around this error is to remove Flatpak from my system during Hardware Setup, and re-enable it later. Though there is no guarantee that Arduino support in Simulink will continue to work after I’ve re-enabled Flatpak (I’ve not tested), so I thought it’s important nevertheless for me to raise this issue. On NixOS (glnxa64), when I have Flatpak enabled, I will receive an error from the following:
Install Simulink Support Package for Arduino Hardware add-on
Start Hardware Setup wizard in said add-on
Get to the stage where the wizard prompts me to Connect an Arduino Board and is detecting boards
Receive error "JSON syntax error at line 1 (character 1), expected ‘false’ but found ‘flatpak’"
There seem to be no log created for this error (or for the Hardware Setup wizard in general), so it’s been difficult for me to debug the exact reason that this is occuring.
The only way I’ve found to work around this error is to remove Flatpak from my system during Hardware Setup, and re-enable it later. Though there is no guarantee that Arduino support in Simulink will continue to work after I’ve re-enabled Flatpak (I’ve not tested), so I thought it’s important nevertheless for me to raise this issue. arduino, simulink, support package, hardware setup MATLAB Answers — New Questions
Any alternative for diode to make the model linear for real-time simulation?
Hello,
I am optimizing matlab/simulink model to run in real-time.
To make the model less computationally expensive, I’m optimizing the model like replacing the switches with variable resistance.
I was wondering if anybody has any suggestions for me to replace the diodes with a linear component.
Please let me know.
Thanks in advanceHello,
I am optimizing matlab/simulink model to run in real-time.
To make the model less computationally expensive, I’m optimizing the model like replacing the switches with variable resistance.
I was wondering if anybody has any suggestions for me to replace the diodes with a linear component.
Please let me know.
Thanks in advance Hello,
I am optimizing matlab/simulink model to run in real-time.
To make the model less computationally expensive, I’m optimizing the model like replacing the switches with variable resistance.
I was wondering if anybody has any suggestions for me to replace the diodes with a linear component.
Please let me know.
Thanks in advance real-time simulation, optimization, diode MATLAB Answers — New Questions
Custom Sugeno Fuzzy Model
How can I use custom output fuctions instead of ‘linear’ and ‘contant’ in a Sugeno Model?How can I use custom output fuctions instead of ‘linear’ and ‘contant’ in a Sugeno Model? How can I use custom output fuctions instead of ‘linear’ and ‘contant’ in a Sugeno Model? fuzzy MATLAB Answers — New Questions
Deployed Matlab function with strage errors: functions not found
Hi there,
I have a new company PC and had to install MATLAB on this PC. I’m currently facing some strange behaviour when deploying my functions and tools written with MATLAB.
I’m using ether MATLAB 2015aSP1 or 2015b as those two versions were the last providing 32bit support. The programs had to run also on older machine PCs therefore this restriction.
However when deploying even a simple function or small tool I always get some strange errors like the self written functions are not found (those functions are in a folder known to MATLAB). When running the functions or programs by MATLAB it works fine. The deployed version does not run.
I’ve installed the latest update for both MATLAB versions.
Im Using Windows 10 Enterprise (Version 10.019045). The MATLAB version is 8.5.1.959712 (R2015a) Service Pack 1 Update 3.
The first error is in which I run with startup.m
savepath(‘pathdef.m’);
The error says "Error using savepath. Too many input arguments"
Canceling out this line I get errors on other lines. It seems that the depolyed version does not find the folder with all the user functions.
The make it more complicated: on my old company PC it worked fine.
Kind regards,
ChristianHi there,
I have a new company PC and had to install MATLAB on this PC. I’m currently facing some strange behaviour when deploying my functions and tools written with MATLAB.
I’m using ether MATLAB 2015aSP1 or 2015b as those two versions were the last providing 32bit support. The programs had to run also on older machine PCs therefore this restriction.
However when deploying even a simple function or small tool I always get some strange errors like the self written functions are not found (those functions are in a folder known to MATLAB). When running the functions or programs by MATLAB it works fine. The deployed version does not run.
I’ve installed the latest update for both MATLAB versions.
Im Using Windows 10 Enterprise (Version 10.019045). The MATLAB version is 8.5.1.959712 (R2015a) Service Pack 1 Update 3.
The first error is in which I run with startup.m
savepath(‘pathdef.m’);
The error says "Error using savepath. Too many input arguments"
Canceling out this line I get errors on other lines. It seems that the depolyed version does not find the folder with all the user functions.
The make it more complicated: on my old company PC it worked fine.
Kind regards,
Christian Hi there,
I have a new company PC and had to install MATLAB on this PC. I’m currently facing some strange behaviour when deploying my functions and tools written with MATLAB.
I’m using ether MATLAB 2015aSP1 or 2015b as those two versions were the last providing 32bit support. The programs had to run also on older machine PCs therefore this restriction.
However when deploying even a simple function or small tool I always get some strange errors like the self written functions are not found (those functions are in a folder known to MATLAB). When running the functions or programs by MATLAB it works fine. The deployed version does not run.
I’ve installed the latest update for both MATLAB versions.
Im Using Windows 10 Enterprise (Version 10.019045). The MATLAB version is 8.5.1.959712 (R2015a) Service Pack 1 Update 3.
The first error is in which I run with startup.m
savepath(‘pathdef.m’);
The error says "Error using savepath. Too many input arguments"
Canceling out this line I get errors on other lines. It seems that the depolyed version does not find the folder with all the user functions.
The make it more complicated: on my old company PC it worked fine.
Kind regards,
Christian mcc, deploy, pathdef, savepath, startup, compiler MATLAB Answers — New Questions
Cannot get fmincon to work
Hello, I am trying to find the max value of a function of 5 variables with all of them constrained between 2 values. However, I do not have experience using this function and I can’t find any good information to use it properly in this scenario either in the MatLab help page, nor in any online tutorial.
As you can see in the code, the function I want to optimize is P, and the variables are V, na, nd, wn and wp.
Apologies if the code is too hard to understand.
clear
close
clc
format long
%% Variables
dp = 11.6;
taup = 3710e-6;
dn = 2;
taun = 371e-6;
Jl = 50e-3;
ni = 9.696e9;
q = 1.602176634e-19;
k = 1.3880649e-23;
T = 300;
ep = 1.035918e-12;
vint = @(na,nd) k.*T/q.*log((na.*nd)./ni^2);
xn = @(na,nd) sqrt((2.*ep.*vint(na,nd).*na)./(q.*nd.*(na+nd)));
xp = @(na,nd) sqrt((2.*ep.*vint(na,nd).*nd)./(q.*na.*(na+nd)));
dnxp = @(V,na) ni^2./na.*(exp(q*V./(k*T))-1);
dpxn = @(V,nd) ni^2./nd.*(exp(q*V./(k*T))-1);
%% Functions
C1 = @(V,na,nd,wn) dnxp(V,na)./(-exp((-2.*wn-xp(na,nd))./sqrt(dn*taun))+exp(xp(na,nd)./sqrt(dn*taun)));
C3 = @(V,na,nd,wp) dpxn(V,nd)./(exp(-xn(na,nd)./sqrt(taup*dp))-exp((2.*wp+xn(na,nd))./sqrt(taup*dp)));
Jn = @(x,V,na,nd,wn) q*sqrt(dn/taun).*C1(V,na,nd,wn).*(exp((-2.*wn-x)./sqrt(dn*taun))+exp(x./sqrt(dn*taun)));
Jp = @(x,V,na,nd,wp) -q*sqrt(dp/taup).*C3(V,na,nd,wp).*(exp(x./sqrt(taup*dp))+exp((2.*wp-x)./sqrt(taup*dp)));
Jd = @(V,na,nd,wn,wp) Jp(-xn(na,nd),V,na,nd,wn)+Jn(xp(na,nd),V,na,nd,wp);
J = @(V,na,nd,wn,wp) Jl-Jd(V,na,nd,wn,wp);
P = @(V,na,nd,wn,wp) J(V,na,nd,wn,wp).*V;
%% Boundaries
wn = [0.05e-4, 0.75e-4];
wp = [100e-4, 200e-4];
nd = [1e18, 5e20];
na = [1e14, 1e16];
V = [0, 0.52];
P0 = [(V(1)+V(2))/2; (wn(1)+wn(2))/2; (wp(1)+wp(2))/2; (nd(1)+nd(2))/2; (na(1)+na(2))/2];
%% Optimization
mx = fmincon(-P(V,wn,wp,nd,na),P0,[],[],[],[],[min(V),wn(1),wp(1),nd(1),na(1)],[max(V),wn(2),wp(2),nd(2),na(2)]);Hello, I am trying to find the max value of a function of 5 variables with all of them constrained between 2 values. However, I do not have experience using this function and I can’t find any good information to use it properly in this scenario either in the MatLab help page, nor in any online tutorial.
As you can see in the code, the function I want to optimize is P, and the variables are V, na, nd, wn and wp.
Apologies if the code is too hard to understand.
clear
close
clc
format long
%% Variables
dp = 11.6;
taup = 3710e-6;
dn = 2;
taun = 371e-6;
Jl = 50e-3;
ni = 9.696e9;
q = 1.602176634e-19;
k = 1.3880649e-23;
T = 300;
ep = 1.035918e-12;
vint = @(na,nd) k.*T/q.*log((na.*nd)./ni^2);
xn = @(na,nd) sqrt((2.*ep.*vint(na,nd).*na)./(q.*nd.*(na+nd)));
xp = @(na,nd) sqrt((2.*ep.*vint(na,nd).*nd)./(q.*na.*(na+nd)));
dnxp = @(V,na) ni^2./na.*(exp(q*V./(k*T))-1);
dpxn = @(V,nd) ni^2./nd.*(exp(q*V./(k*T))-1);
%% Functions
C1 = @(V,na,nd,wn) dnxp(V,na)./(-exp((-2.*wn-xp(na,nd))./sqrt(dn*taun))+exp(xp(na,nd)./sqrt(dn*taun)));
C3 = @(V,na,nd,wp) dpxn(V,nd)./(exp(-xn(na,nd)./sqrt(taup*dp))-exp((2.*wp+xn(na,nd))./sqrt(taup*dp)));
Jn = @(x,V,na,nd,wn) q*sqrt(dn/taun).*C1(V,na,nd,wn).*(exp((-2.*wn-x)./sqrt(dn*taun))+exp(x./sqrt(dn*taun)));
Jp = @(x,V,na,nd,wp) -q*sqrt(dp/taup).*C3(V,na,nd,wp).*(exp(x./sqrt(taup*dp))+exp((2.*wp-x)./sqrt(taup*dp)));
Jd = @(V,na,nd,wn,wp) Jp(-xn(na,nd),V,na,nd,wn)+Jn(xp(na,nd),V,na,nd,wp);
J = @(V,na,nd,wn,wp) Jl-Jd(V,na,nd,wn,wp);
P = @(V,na,nd,wn,wp) J(V,na,nd,wn,wp).*V;
%% Boundaries
wn = [0.05e-4, 0.75e-4];
wp = [100e-4, 200e-4];
nd = [1e18, 5e20];
na = [1e14, 1e16];
V = [0, 0.52];
P0 = [(V(1)+V(2))/2; (wn(1)+wn(2))/2; (wp(1)+wp(2))/2; (nd(1)+nd(2))/2; (na(1)+na(2))/2];
%% Optimization
mx = fmincon(-P(V,wn,wp,nd,na),P0,[],[],[],[],[min(V),wn(1),wp(1),nd(1),na(1)],[max(V),wn(2),wp(2),nd(2),na(2)]); Hello, I am trying to find the max value of a function of 5 variables with all of them constrained between 2 values. However, I do not have experience using this function and I can’t find any good information to use it properly in this scenario either in the MatLab help page, nor in any online tutorial.
As you can see in the code, the function I want to optimize is P, and the variables are V, na, nd, wn and wp.
Apologies if the code is too hard to understand.
clear
close
clc
format long
%% Variables
dp = 11.6;
taup = 3710e-6;
dn = 2;
taun = 371e-6;
Jl = 50e-3;
ni = 9.696e9;
q = 1.602176634e-19;
k = 1.3880649e-23;
T = 300;
ep = 1.035918e-12;
vint = @(na,nd) k.*T/q.*log((na.*nd)./ni^2);
xn = @(na,nd) sqrt((2.*ep.*vint(na,nd).*na)./(q.*nd.*(na+nd)));
xp = @(na,nd) sqrt((2.*ep.*vint(na,nd).*nd)./(q.*na.*(na+nd)));
dnxp = @(V,na) ni^2./na.*(exp(q*V./(k*T))-1);
dpxn = @(V,nd) ni^2./nd.*(exp(q*V./(k*T))-1);
%% Functions
C1 = @(V,na,nd,wn) dnxp(V,na)./(-exp((-2.*wn-xp(na,nd))./sqrt(dn*taun))+exp(xp(na,nd)./sqrt(dn*taun)));
C3 = @(V,na,nd,wp) dpxn(V,nd)./(exp(-xn(na,nd)./sqrt(taup*dp))-exp((2.*wp+xn(na,nd))./sqrt(taup*dp)));
Jn = @(x,V,na,nd,wn) q*sqrt(dn/taun).*C1(V,na,nd,wn).*(exp((-2.*wn-x)./sqrt(dn*taun))+exp(x./sqrt(dn*taun)));
Jp = @(x,V,na,nd,wp) -q*sqrt(dp/taup).*C3(V,na,nd,wp).*(exp(x./sqrt(taup*dp))+exp((2.*wp-x)./sqrt(taup*dp)));
Jd = @(V,na,nd,wn,wp) Jp(-xn(na,nd),V,na,nd,wn)+Jn(xp(na,nd),V,na,nd,wp);
J = @(V,na,nd,wn,wp) Jl-Jd(V,na,nd,wn,wp);
P = @(V,na,nd,wn,wp) J(V,na,nd,wn,wp).*V;
%% Boundaries
wn = [0.05e-4, 0.75e-4];
wp = [100e-4, 200e-4];
nd = [1e18, 5e20];
na = [1e14, 1e16];
V = [0, 0.52];
P0 = [(V(1)+V(2))/2; (wn(1)+wn(2))/2; (wp(1)+wp(2))/2; (nd(1)+nd(2))/2; (na(1)+na(2))/2];
%% Optimization
mx = fmincon(-P(V,wn,wp,nd,na),P0,[],[],[],[],[min(V),wn(1),wp(1),nd(1),na(1)],[max(V),wn(2),wp(2),nd(2),na(2)]); optimization, fmincon MATLAB Answers — New Questions
Error in Integrator block
Error:An error occurred during simulation and the simulation was terminated
Caused by:
Derivative of state ‘1’ in block ‘HW02_2024_SimulinkModel/VD model/velocity’ at time 64.05749999999999 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
at my integrator block.Error:An error occurred during simulation and the simulation was terminated
Caused by:
Derivative of state ‘1’ in block ‘HW02_2024_SimulinkModel/VD model/velocity’ at time 64.05749999999999 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
at my integrator block. Error:An error occurred during simulation and the simulation was terminated
Caused by:
Derivative of state ‘1’ in block ‘HW02_2024_SimulinkModel/VD model/velocity’ at time 64.05749999999999 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
at my integrator block. simulink, matlab compiler MATLAB Answers — New Questions
Too Much Variables in Fuzzy Logic and ANFIS
Hi i have 13 variables and some of them has 5 membership. I can’t define all rules (1 billion rules). How can i define that rules?
And my data has 16000 rows how can i train fis without memory problem?
P.S.I can only use some of GUI’s so please keep it simple.
ThxHi i have 13 variables and some of them has 5 membership. I can’t define all rules (1 billion rules). How can i define that rules?
And my data has 16000 rows how can i train fis without memory problem?
P.S.I can only use some of GUI’s so please keep it simple.
Thx Hi i have 13 variables and some of them has 5 membership. I can’t define all rules (1 billion rules). How can i define that rules?
And my data has 16000 rows how can i train fis without memory problem?
P.S.I can only use some of GUI’s so please keep it simple.
Thx fuzzy, variables, membership, fuzzy rules, anfis MATLAB Answers — New Questions
Calculation not having the desired array size
I am trying to calcumate the Acceleration using a rotational matrix, during the loop the left side is a 3×14074 (good), but the right is (3×3) which I don’t want. How can I fix this so the right side has a matching size? Thanks
% Acc and AngV are sensor data sets and have sizes of 14074×3
% qF is 3x3x14074
g = [0,0,9.81];
xn = zeros(3, length(Acc));
fuse = imufilter(‘SampleRate’,100,’DecimationFactor’,1);
q = fuse(Acc, AngV);
qF = quat2rotm(q);
for i=1:length(AngV)
xn(1:3,:) = qF(:,:,i) .* Acc(i,:)’ – g; % This is where the error arises
end
vi = xn .* dt;
ri = .5 * xn .* (dt^2);
I’ve tried every combination of transforms and reordering that I could think of, everything gives 3×3 or 3×1. Somehow I used to have this work for me, then I woke up and bam, its broken.
Error:
Unable to perform assignment because the size of the left side is 3-by-14074 and the size of the right side is 3-by-3.
Error in RunKalman (line 27)
xn(1:3, 🙂 = qF(:, :, i)’ .* Acc(i, :)’ – g;I am trying to calcumate the Acceleration using a rotational matrix, during the loop the left side is a 3×14074 (good), but the right is (3×3) which I don’t want. How can I fix this so the right side has a matching size? Thanks
% Acc and AngV are sensor data sets and have sizes of 14074×3
% qF is 3x3x14074
g = [0,0,9.81];
xn = zeros(3, length(Acc));
fuse = imufilter(‘SampleRate’,100,’DecimationFactor’,1);
q = fuse(Acc, AngV);
qF = quat2rotm(q);
for i=1:length(AngV)
xn(1:3,:) = qF(:,:,i) .* Acc(i,:)’ – g; % This is where the error arises
end
vi = xn .* dt;
ri = .5 * xn .* (dt^2);
I’ve tried every combination of transforms and reordering that I could think of, everything gives 3×3 or 3×1. Somehow I used to have this work for me, then I woke up and bam, its broken.
Error:
Unable to perform assignment because the size of the left side is 3-by-14074 and the size of the right side is 3-by-3.
Error in RunKalman (line 27)
xn(1:3, 🙂 = qF(:, :, i)’ .* Acc(i, :)’ – g; I am trying to calcumate the Acceleration using a rotational matrix, during the loop the left side is a 3×14074 (good), but the right is (3×3) which I don’t want. How can I fix this so the right side has a matching size? Thanks
% Acc and AngV are sensor data sets and have sizes of 14074×3
% qF is 3x3x14074
g = [0,0,9.81];
xn = zeros(3, length(Acc));
fuse = imufilter(‘SampleRate’,100,’DecimationFactor’,1);
q = fuse(Acc, AngV);
qF = quat2rotm(q);
for i=1:length(AngV)
xn(1:3,:) = qF(:,:,i) .* Acc(i,:)’ – g; % This is where the error arises
end
vi = xn .* dt;
ri = .5 * xn .* (dt^2);
I’ve tried every combination of transforms and reordering that I could think of, everything gives 3×3 or 3×1. Somehow I used to have this work for me, then I woke up and bam, its broken.
Error:
Unable to perform assignment because the size of the left side is 3-by-14074 and the size of the right side is 3-by-3.
Error in RunKalman (line 27)
xn(1:3, 🙂 = qF(:, :, i)’ .* Acc(i, :)’ – g; matrix manipulation, matrix array MATLAB Answers — New Questions
how to plot 4D figure to describe changing in ocean ?
Hi,
I have the oceanographic data ( Longitude , Latitude , Density ,Depth)
I want to plot the change of density with depth such as the picture
I try to plot with surf but give me the surface changing
Also I try slice but did’t work because my data is 2D
Longitude =300*400,
Latitude =300*400 ,
Density =300*400,
Depth =300*400Hi,
I have the oceanographic data ( Longitude , Latitude , Density ,Depth)
I want to plot the change of density with depth such as the picture
I try to plot with surf but give me the surface changing
Also I try slice but did’t work because my data is 2D
Longitude =300*400,
Latitude =300*400 ,
Density =300*400,
Depth =300*400 Hi,
I have the oceanographic data ( Longitude , Latitude , Density ,Depth)
I want to plot the change of density with depth such as the picture
I try to plot with surf but give me the surface changing
Also I try slice but did’t work because my data is 2D
Longitude =300*400,
Latitude =300*400 ,
Density =300*400,
Depth =300*400 surf, 3dplot, slice MATLAB Answers — New Questions
x(n)=u(n-2)-u(n-5)
x(n)=u(n-2)-u(n-5)x(n)=u(n-2)-u(n-5) x(n)=u(n-2)-u(n-5) x(n)=u(n-2)-u(n-5) MATLAB Answers — New Questions
You need to perform the analysis of braking by following the same methodology that was used to analyze traction/acceleration in the session.
The following are the deliverables (using Matlab):
Develop the Kf_Braking script file (similar to Kf_Traction file that has been shared) to plot the deceleration vs. Kf curve. Here, the Kf indicates the front braking torque distribution factor. You need to submit this plot indicating the:
Kf_opt value (ensure it matches with the value from the analytical expression);
no slip, the rear wheel skid & front wheel skid regions.
(You are free to choose & coefficient of friction.)
Develop the Vehicle_Braking script file (similar to Vehicle_Traction file that has been shared).
Starting from rest, accelerate the vehicle to reach a speed of 30m/s by applying an appropriate T_in (the wheels shouldn’t slip)
Apply brakes after 5 seconds (the vehicle moves with a constant speed in this time span). Consider any T_app for any Kf < Kf_opt, Kf = Kf_opt & Kf > Kf_opt
T_app < T_opt
T_app = T_opt
T_opt < T_app < T_sat
T_app = T_sat
T_app > T_sat
Find out the values of the normal reactions, the braking forces, the deceleration & the stopping distance both analytically & virtually (simulation). Prepare a table & share it along with the Matlab screenshot of the display chart highlighting these values.The following are the deliverables (using Matlab):
Develop the Kf_Braking script file (similar to Kf_Traction file that has been shared) to plot the deceleration vs. Kf curve. Here, the Kf indicates the front braking torque distribution factor. You need to submit this plot indicating the:
Kf_opt value (ensure it matches with the value from the analytical expression);
no slip, the rear wheel skid & front wheel skid regions.
(You are free to choose & coefficient of friction.)
Develop the Vehicle_Braking script file (similar to Vehicle_Traction file that has been shared).
Starting from rest, accelerate the vehicle to reach a speed of 30m/s by applying an appropriate T_in (the wheels shouldn’t slip)
Apply brakes after 5 seconds (the vehicle moves with a constant speed in this time span). Consider any T_app for any Kf < Kf_opt, Kf = Kf_opt & Kf > Kf_opt
T_app < T_opt
T_app = T_opt
T_opt < T_app < T_sat
T_app = T_sat
T_app > T_sat
Find out the values of the normal reactions, the braking forces, the deceleration & the stopping distance both analytically & virtually (simulation). Prepare a table & share it along with the Matlab screenshot of the display chart highlighting these values. The following are the deliverables (using Matlab):
Develop the Kf_Braking script file (similar to Kf_Traction file that has been shared) to plot the deceleration vs. Kf curve. Here, the Kf indicates the front braking torque distribution factor. You need to submit this plot indicating the:
Kf_opt value (ensure it matches with the value from the analytical expression);
no slip, the rear wheel skid & front wheel skid regions.
(You are free to choose & coefficient of friction.)
Develop the Vehicle_Braking script file (similar to Vehicle_Traction file that has been shared).
Starting from rest, accelerate the vehicle to reach a speed of 30m/s by applying an appropriate T_in (the wheels shouldn’t slip)
Apply brakes after 5 seconds (the vehicle moves with a constant speed in this time span). Consider any T_app for any Kf < Kf_opt, Kf = Kf_opt & Kf > Kf_opt
T_app < T_opt
T_app = T_opt
T_opt < T_app < T_sat
T_app = T_sat
T_app > T_sat
Find out the values of the normal reactions, the braking forces, the deceleration & the stopping distance both analytically & virtually (simulation). Prepare a table & share it along with the Matlab screenshot of the display chart highlighting these values. matlab MATLAB Answers — New Questions
Stellar motion part 2, task 5
I’m doing the 5th task of Stellar motion part 2 and I keep getting it marked as wrong.
The solution to the task is
legend(starnames)
and even though I’ve tried a million ways of reentering it (restarting the task, writing it manually, copying and pasting the solution code), I keep getting a message telling me that "’legend’ appears to be both a function and a variable". I can’t keep going with the intro if this isn’t accepted. Help :(I’m doing the 5th task of Stellar motion part 2 and I keep getting it marked as wrong.
The solution to the task is
legend(starnames)
and even though I’ve tried a million ways of reentering it (restarting the task, writing it manually, copying and pasting the solution code), I keep getting a message telling me that "’legend’ appears to be both a function and a variable". I can’t keep going with the intro if this isn’t accepted. Help 🙁 I’m doing the 5th task of Stellar motion part 2 and I keep getting it marked as wrong.
The solution to the task is
legend(starnames)
and even though I’ve tried a million ways of reentering it (restarting the task, writing it manually, copying and pasting the solution code), I keep getting a message telling me that "’legend’ appears to be both a function and a variable". I can’t keep going with the intro if this isn’t accepted. Help 🙁 error, legend, array MATLAB Answers — New Questions