Category: Matlab
Category Archives: Matlab
Dividing a number by a column matrix in Matlab
For example if I were to type this in matlab:
>> 1/[1, 2 ,3]
There would be an error:
>> Error using /
Matrix dimensions must agree.
But if I were to type this in Matlab
>> 1/[1; 2; 3]
The answer would be:
[0 0 0.3333]
Why is Matlab doing this ?For example if I were to type this in matlab:
>> 1/[1, 2 ,3]
There would be an error:
>> Error using /
Matrix dimensions must agree.
But if I were to type this in Matlab
>> 1/[1; 2; 3]
The answer would be:
[0 0 0.3333]
Why is Matlab doing this ? For example if I were to type this in matlab:
>> 1/[1, 2 ,3]
There would be an error:
>> Error using /
Matrix dimensions must agree.
But if I were to type this in Matlab
>> 1/[1; 2; 3]
The answer would be:
[0 0 0.3333]
Why is Matlab doing this ? matlab, matrix MATLAB Answers — New Questions
Steady state error in DDPG control
I am trying to make some modifications in Control Water Level in a Tank Using a DDPG Agent example. I want to reduce sample time from 1.0 to 0.5, so I set Ts = 0.5. Consequently, I had to make adjustment on StopTrainingValue, i.e., changed its value from 2000 to 4000. The training process was successfully completed as it can be seen below.
But there is something unexpected happened: this modifications introduce a steady state error (or something similar to) that wasn’t there in the original example.
How to overcome this steady state error? Do I need to make additional adjustments, e.g. make changes to the structure of observations, reward function, actor/critic network, StopTrainingCriteria, etc?
Update:
This is the error I get using pre-trained agent (doTraining = false, no change on the original example)
This is the error I get using re-trained agent (doTraining = true, no change on the original example)I am trying to make some modifications in Control Water Level in a Tank Using a DDPG Agent example. I want to reduce sample time from 1.0 to 0.5, so I set Ts = 0.5. Consequently, I had to make adjustment on StopTrainingValue, i.e., changed its value from 2000 to 4000. The training process was successfully completed as it can be seen below.
But there is something unexpected happened: this modifications introduce a steady state error (or something similar to) that wasn’t there in the original example.
How to overcome this steady state error? Do I need to make additional adjustments, e.g. make changes to the structure of observations, reward function, actor/critic network, StopTrainingCriteria, etc?
Update:
This is the error I get using pre-trained agent (doTraining = false, no change on the original example)
This is the error I get using re-trained agent (doTraining = true, no change on the original example) I am trying to make some modifications in Control Water Level in a Tank Using a DDPG Agent example. I want to reduce sample time from 1.0 to 0.5, so I set Ts = 0.5. Consequently, I had to make adjustment on StopTrainingValue, i.e., changed its value from 2000 to 4000. The training process was successfully completed as it can be seen below.
But there is something unexpected happened: this modifications introduce a steady state error (or something similar to) that wasn’t there in the original example.
How to overcome this steady state error? Do I need to make additional adjustments, e.g. make changes to the structure of observations, reward function, actor/critic network, StopTrainingCriteria, etc?
Update:
This is the error I get using pre-trained agent (doTraining = false, no change on the original example)
This is the error I get using re-trained agent (doTraining = true, no change on the original example) control, reinforcement learning, deep learning MATLAB Answers — New Questions
How to include complex numbers in fprintf function?
lambda = [1.064e-6];
R = [30];
w=[0.001];
q = (1./R- i* lambda./pi./w.^2).^(-1);
a=1;
p=1;
m=1;
probe_r=linspace(0,0.003,100);
probe_theta=linspace(0,0.003,100);
rseed=[0*max(w):max(w)/30:3*max(w)];
thetaseed=[0:360]*pi/180;
[r,theta]=meshgrid(rseed,thetaseed);
E=LaguerreGaussianE([p,m,q,lambda,a],r,theta);
V=interp2(r,theta,E,probe_r,probe_theta);
column_names = {‘r’, ‘theta’, ‘V’};
fid = fopen(‘fidtext.txt’,’wt’);
fprintf(fid, ‘%s ‘, column_names{:});
fprintf(fid, ‘n’);
block_of_data = [probe_r, probe_theta, V];
fmt = repmat(‘%15g ‘, 1, 3);
fmt(end:end+1) = ‘n’;
fprintf(fid, fmt, block_of_data.’);
fclose(fid);
With the current code I have I get a .txt file of only the real numbers from my function V along with the values of probe_r and probe_theta. How do I alter this to produce both the real and complex numbers as a 3 column .txt file of r, theta and V as I am unable to see a formatSpec to include complex numbers.lambda = [1.064e-6];
R = [30];
w=[0.001];
q = (1./R- i* lambda./pi./w.^2).^(-1);
a=1;
p=1;
m=1;
probe_r=linspace(0,0.003,100);
probe_theta=linspace(0,0.003,100);
rseed=[0*max(w):max(w)/30:3*max(w)];
thetaseed=[0:360]*pi/180;
[r,theta]=meshgrid(rseed,thetaseed);
E=LaguerreGaussianE([p,m,q,lambda,a],r,theta);
V=interp2(r,theta,E,probe_r,probe_theta);
column_names = {‘r’, ‘theta’, ‘V’};
fid = fopen(‘fidtext.txt’,’wt’);
fprintf(fid, ‘%s ‘, column_names{:});
fprintf(fid, ‘n’);
block_of_data = [probe_r, probe_theta, V];
fmt = repmat(‘%15g ‘, 1, 3);
fmt(end:end+1) = ‘n’;
fprintf(fid, fmt, block_of_data.’);
fclose(fid);
With the current code I have I get a .txt file of only the real numbers from my function V along with the values of probe_r and probe_theta. How do I alter this to produce both the real and complex numbers as a 3 column .txt file of r, theta and V as I am unable to see a formatSpec to include complex numbers. lambda = [1.064e-6];
R = [30];
w=[0.001];
q = (1./R- i* lambda./pi./w.^2).^(-1);
a=1;
p=1;
m=1;
probe_r=linspace(0,0.003,100);
probe_theta=linspace(0,0.003,100);
rseed=[0*max(w):max(w)/30:3*max(w)];
thetaseed=[0:360]*pi/180;
[r,theta]=meshgrid(rseed,thetaseed);
E=LaguerreGaussianE([p,m,q,lambda,a],r,theta);
V=interp2(r,theta,E,probe_r,probe_theta);
column_names = {‘r’, ‘theta’, ‘V’};
fid = fopen(‘fidtext.txt’,’wt’);
fprintf(fid, ‘%s ‘, column_names{:});
fprintf(fid, ‘n’);
block_of_data = [probe_r, probe_theta, V];
fmt = repmat(‘%15g ‘, 1, 3);
fmt(end:end+1) = ‘n’;
fprintf(fid, fmt, block_of_data.’);
fclose(fid);
With the current code I have I get a .txt file of only the real numbers from my function V along with the values of probe_r and probe_theta. How do I alter this to produce both the real and complex numbers as a 3 column .txt file of r, theta and V as I am unable to see a formatSpec to include complex numbers. fprintf, complex numbers MATLAB Answers — New Questions
Why does the “Test Connection” for Bluetooth fail in the hardware setup screen for the Arduino support package on macOS versions 12, 13 and 14 ?
Issue:
Why does the "Test Connection" for Bluetooth fail in the hardware setup screen for the Arduino support package on macOS versions 12, 13 and 14?
I am using an Arduino Uno with an HC-05 Bluetooth module, intending to integrate it with the MATLAB Support Package for Arduino Hardware on my Mac running Ventura OS 13. While I can successfully program the board via the hardware setup screen, the "Test Connection" button consistently triggers a prompt outside of the MATLAB window requesting a device connection. Despite clicking "Connect" on this prompt, the test connection fails in the hardware setup screen, preventing further progress.
This issue also occurs on macOS 12 Monterey and macOS 14 Sonoma.
Prompt:
Test Connection failure:Issue:
Why does the "Test Connection" for Bluetooth fail in the hardware setup screen for the Arduino support package on macOS versions 12, 13 and 14?
I am using an Arduino Uno with an HC-05 Bluetooth module, intending to integrate it with the MATLAB Support Package for Arduino Hardware on my Mac running Ventura OS 13. While I can successfully program the board via the hardware setup screen, the "Test Connection" button consistently triggers a prompt outside of the MATLAB window requesting a device connection. Despite clicking "Connect" on this prompt, the test connection fails in the hardware setup screen, preventing further progress.
This issue also occurs on macOS 12 Monterey and macOS 14 Sonoma.
Prompt:
Test Connection failure: Issue:
Why does the "Test Connection" for Bluetooth fail in the hardware setup screen for the Arduino support package on macOS versions 12, 13 and 14?
I am using an Arduino Uno with an HC-05 Bluetooth module, intending to integrate it with the MATLAB Support Package for Arduino Hardware on my Mac running Ventura OS 13. While I can successfully program the board via the hardware setup screen, the "Test Connection" button consistently triggers a prompt outside of the MATLAB window requesting a device connection. Despite clicking "Connect" on this prompt, the test connection fails in the hardware setup screen, preventing further progress.
This issue also occurs on macOS 12 Monterey and macOS 14 Sonoma.
Prompt:
Test Connection failure: arduino, mac MATLAB Answers — New Questions
Why am I getting a Complex signal mismatch error when using the Simscape power system FACT element – UPFC(phasor model)
I got the following error when I tried a simulink model (named UPFC compensated line) of a power system using only the Simscape powersystem specialised technology components.
Complex signal mismatch. Input port 1 of ‘UPFC_compensated_line/Unified Power Flow Controller (Phasor Type)/Power Components Modeling (Shunt & Series Converter)/Power Components modeling (Shunt Converter)/Demux1’ expects a signal of numeric type real. However, it is driven by a signal of numeric type complex
Component: Simulink | Category: Block error
Complex signal mismatch. Output port 1 of ‘UPFC_compensated_line/Unified Power Flow Controller (Phasor Type)/Power Components Modeling (Shunt & Series Converter)/Power Components modeling (Shunt Converter)/dq-axis model of 3-ph RL branch’ is a signal of numeric type complex. However, it is driving a signal of numeric type real
What might be the reason? Please help to resolve the problemI got the following error when I tried a simulink model (named UPFC compensated line) of a power system using only the Simscape powersystem specialised technology components.
Complex signal mismatch. Input port 1 of ‘UPFC_compensated_line/Unified Power Flow Controller (Phasor Type)/Power Components Modeling (Shunt & Series Converter)/Power Components modeling (Shunt Converter)/Demux1’ expects a signal of numeric type real. However, it is driven by a signal of numeric type complex
Component: Simulink | Category: Block error
Complex signal mismatch. Output port 1 of ‘UPFC_compensated_line/Unified Power Flow Controller (Phasor Type)/Power Components Modeling (Shunt & Series Converter)/Power Components modeling (Shunt Converter)/dq-axis model of 3-ph RL branch’ is a signal of numeric type complex. However, it is driving a signal of numeric type real
What might be the reason? Please help to resolve the problem I got the following error when I tried a simulink model (named UPFC compensated line) of a power system using only the Simscape powersystem specialised technology components.
Complex signal mismatch. Input port 1 of ‘UPFC_compensated_line/Unified Power Flow Controller (Phasor Type)/Power Components Modeling (Shunt & Series Converter)/Power Components modeling (Shunt Converter)/Demux1’ expects a signal of numeric type real. However, it is driven by a signal of numeric type complex
Component: Simulink | Category: Block error
Complex signal mismatch. Output port 1 of ‘UPFC_compensated_line/Unified Power Flow Controller (Phasor Type)/Power Components Modeling (Shunt & Series Converter)/Power Components modeling (Shunt Converter)/dq-axis model of 3-ph RL branch’ is a signal of numeric type complex. However, it is driving a signal of numeric type real
What might be the reason? Please help to resolve the problem upfc, signal mismatch MATLAB Answers — New Questions
Why does Matlab recommend keeping the Documentation on the Web?
Why does Matlab recommend keeping the Documentation on the Web. It is painfully slow compared to having it stored locally on your machine, even with a fast internet connection.Why does Matlab recommend keeping the Documentation on the Web. It is painfully slow compared to having it stored locally on your machine, even with a fast internet connection. Why does Matlab recommend keeping the Documentation on the Web. It is painfully slow compared to having it stored locally on your machine, even with a fast internet connection. documentation MATLAB Answers — New Questions
algorithm of envelope function ‘peak’ option
Hello,
I’m using the envelope function with ‘peak’ option, [yupper,ylower] = envelope(x,np,’peak’).
The description says, ‘The envelopes are determined using spline interpolation over local maxima separated by at least np samples.’
I’m wondering that what order is used in the spline interpolation and also how the local maxima are calculated, separated by ‘at least’ np samples.
If I can, I would like to know the algorithm too.
Thank you.Hello,
I’m using the envelope function with ‘peak’ option, [yupper,ylower] = envelope(x,np,’peak’).
The description says, ‘The envelopes are determined using spline interpolation over local maxima separated by at least np samples.’
I’m wondering that what order is used in the spline interpolation and also how the local maxima are calculated, separated by ‘at least’ np samples.
If I can, I would like to know the algorithm too.
Thank you. Hello,
I’m using the envelope function with ‘peak’ option, [yupper,ylower] = envelope(x,np,’peak’).
The description says, ‘The envelopes are determined using spline interpolation over local maxima separated by at least np samples.’
I’m wondering that what order is used in the spline interpolation and also how the local maxima are calculated, separated by ‘at least’ np samples.
If I can, I would like to know the algorithm too.
Thank you. envelope, algorithm MATLAB Answers — New Questions
Using polyeig with scaling matrices
I’m using the function polyeig to solve a quadratic eigenvalue problem with complex matrices A0.A1 and A2 (A2 is singular; has only two non-zero rows).
The result was so bad, and according to the help center of Mathworks : (Scaling A0,A1,…,Ap to have norm(Ai) roughly equal to 1 might increase the accuracy of polyeig)
https://www.mathworks.com/help/matlab/ref/polyeig.html
Is there any function in Matlab to do this scaling?
Thanks in advance;I’m using the function polyeig to solve a quadratic eigenvalue problem with complex matrices A0.A1 and A2 (A2 is singular; has only two non-zero rows).
The result was so bad, and according to the help center of Mathworks : (Scaling A0,A1,…,Ap to have norm(Ai) roughly equal to 1 might increase the accuracy of polyeig)
https://www.mathworks.com/help/matlab/ref/polyeig.html
Is there any function in Matlab to do this scaling?
Thanks in advance; I’m using the function polyeig to solve a quadratic eigenvalue problem with complex matrices A0.A1 and A2 (A2 is singular; has only two non-zero rows).
The result was so bad, and according to the help center of Mathworks : (Scaling A0,A1,…,Ap to have norm(Ai) roughly equal to 1 might increase the accuracy of polyeig)
https://www.mathworks.com/help/matlab/ref/polyeig.html
Is there any function in Matlab to do this scaling?
Thanks in advance; polyeig, matlab, scaling, complex matrix, eigenvalue-problem MATLAB Answers — New Questions
comsol LiveLink for MATLAB: output solutions on a specific line (in reference or current configuration)
In a 3D comsol model, how to output the solution on a specific line (in reference or current configuration)? In .mph comsol models, it’s like the
comp1.at3
command that is equivalent.In a 3D comsol model, how to output the solution on a specific line (in reference or current configuration)? In .mph comsol models, it’s like the
comp1.at3
command that is equivalent. In a 3D comsol model, how to output the solution on a specific line (in reference or current configuration)? In .mph comsol models, it’s like the
comp1.at3
command that is equivalent. comsol MATLAB Answers — New Questions
Matrix function — problem with the defi
Hi!
I wrote this code where Y is a cell array (actually is a matrix [y1; y2; y3] and F is a matrix that I would like to be like the function of Y — I mean if Y = [y1; y2; y3] -> F(Y) = [1; y3; f(y1, y2, y3)] where f – another function.
How can I realize this in Matlab? Unfortunely this code does not work in an appropriate way. ;(
Thanks!
Y = @(y1, y2, y3) {@(y1) y1; @(y2) y2; @(y3) y3};
F = @(Y) [1; Y(3); f(Y(1), Y(2), Y(3))]Hi!
I wrote this code where Y is a cell array (actually is a matrix [y1; y2; y3] and F is a matrix that I would like to be like the function of Y — I mean if Y = [y1; y2; y3] -> F(Y) = [1; y3; f(y1, y2, y3)] where f – another function.
How can I realize this in Matlab? Unfortunely this code does not work in an appropriate way. ;(
Thanks!
Y = @(y1, y2, y3) {@(y1) y1; @(y2) y2; @(y3) y3};
F = @(Y) [1; Y(3); f(Y(1), Y(2), Y(3))] Hi!
I wrote this code where Y is a cell array (actually is a matrix [y1; y2; y3] and F is a matrix that I would like to be like the function of Y — I mean if Y = [y1; y2; y3] -> F(Y) = [1; y3; f(y1, y2, y3)] where f – another function.
How can I realize this in Matlab? Unfortunely this code does not work in an appropriate way. ;(
Thanks!
Y = @(y1, y2, y3) {@(y1) y1; @(y2) y2; @(y3) y3};
F = @(Y) [1; Y(3); f(Y(1), Y(2), Y(3))] function, matrix, array, cell arrays MATLAB Answers — New Questions
FOC BLDC with mathematical model
I have simulated FOC with BLDC using mathematical model but Iam getting negative speed. Can anyone help me identify what is the issue with the mode. I have used the same with bldc motor block(PMSM block with trapizoidal back emf) that is working but this one is going to negative speed.I have simulated FOC with BLDC using mathematical model but Iam getting negative speed. Can anyone help me identify what is the issue with the mode. I have used the same with bldc motor block(PMSM block with trapizoidal back emf) that is working but this one is going to negative speed. I have simulated FOC with BLDC using mathematical model but Iam getting negative speed. Can anyone help me identify what is the issue with the mode. I have used the same with bldc motor block(PMSM block with trapizoidal back emf) that is working but this one is going to negative speed. foc MATLAB Answers — New Questions
what is 2+2
what is 2+2what is 2+2 what is 2+2 — MATLAB Answers — New Questions
Image Processing for ultrasound
I would like to do image processing to recognize a needle in an ultrasound image. Such as the one below
This image is scaled down to 20%
Currently I am thinking about blurring, created a region of interest, thresholding the image and then identifiying the most continous blob of white pixels.
Does anyone have a way to create a blur that utilizes the brightest pixels to change the pixels around it?
Other feedback and methods and input would also be appreciated.
Also @Image Analyst might be interetstedI would like to do image processing to recognize a needle in an ultrasound image. Such as the one below
This image is scaled down to 20%
Currently I am thinking about blurring, created a region of interest, thresholding the image and then identifiying the most continous blob of white pixels.
Does anyone have a way to create a blur that utilizes the brightest pixels to change the pixels around it?
Other feedback and methods and input would also be appreciated.
Also @Image Analyst might be interetsted I would like to do image processing to recognize a needle in an ultrasound image. Such as the one below
This image is scaled down to 20%
Currently I am thinking about blurring, created a region of interest, thresholding the image and then identifiying the most continous blob of white pixels.
Does anyone have a way to create a blur that utilizes the brightest pixels to change the pixels around it?
Other feedback and methods and input would also be appreciated.
Also @Image Analyst might be interetsted image analysis, digital image processing, ultrasound MATLAB Answers — New Questions
How to combine all script windows into one window with tabs
Hi there
Silly question. I used to have all of my scripts as tabs in a single window. Now, for some reason, Matlab shows me each new script in a separate window, which quickly gets very difficult to manage. How do I revert this sudden change back to the normal setting?
Cheers
JakobHi there
Silly question. I used to have all of my scripts as tabs in a single window. Now, for some reason, Matlab shows me each new script in a separate window, which quickly gets very difficult to manage. How do I revert this sudden change back to the normal setting?
Cheers
Jakob Hi there
Silly question. I used to have all of my scripts as tabs in a single window. Now, for some reason, Matlab shows me each new script in a separate window, which quickly gets very difficult to manage. How do I revert this sudden change back to the normal setting?
Cheers
Jakob matlab, script MATLAB Answers — New Questions
how can I link subplots (for brush data)?
how can I link subplots (for brush data)?
this is my code :
colors = {‘r’, ‘g’, ‘b’, ‘c’, ‘m’, ‘y’, ‘k’, [0, 0.5, 0.5], [0.5, 0.5, 0], [0, 0.5, 0], [0.5, 0, 0],[0, 0, 0.5], [0.5, 0.5, 0.5],[0.3010 0.7450 0.9330],[0.4660 0.6740 0.1880],[0.4940 0.1840 0.5560],[0.9290 0.6940 0.1250],[0.8500 0.3250 0.0980],[0.6350, 0.0780, 0.1840],[0 0.4470 0.7410] };
[filename,pathname] = uigetfile(‘*.csv’, ‘Select CSV files’, ‘MultiSelect’, ‘on’);
if isnumeric(filename) % user clicked Cancel
return
end
s=size(filename,2);
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData2=table2array(o(:,2));
fig = figure();
subplot(3,1,1)
p1=plot( cData1,cData2,…
‘Color’, colors{mod(i, numel(colors)) + 1});
hold(‘on’)
end
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData3=table2array(o(:,3));
subplot(3,1,2)
p2=plot( cData1,cData3,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2_2,’on’)
hold(‘on’)
end
%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData4=table2array(o(:,4));
subplot(3,1,3)
p3=plot( cData1,cData4,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2,’on’)
hold(‘on’)
end
b=brush(fig);
b.ActionPostCallback = {@onBrushAction,p1,p2,p3};
% callback function
function onBrushAction(~, eventdata,p1,p2,p3)
set(p1, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p2, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p3, ‘BrushData’, eventdata.Axes.Children.BrushData)
endhow can I link subplots (for brush data)?
this is my code :
colors = {‘r’, ‘g’, ‘b’, ‘c’, ‘m’, ‘y’, ‘k’, [0, 0.5, 0.5], [0.5, 0.5, 0], [0, 0.5, 0], [0.5, 0, 0],[0, 0, 0.5], [0.5, 0.5, 0.5],[0.3010 0.7450 0.9330],[0.4660 0.6740 0.1880],[0.4940 0.1840 0.5560],[0.9290 0.6940 0.1250],[0.8500 0.3250 0.0980],[0.6350, 0.0780, 0.1840],[0 0.4470 0.7410] };
[filename,pathname] = uigetfile(‘*.csv’, ‘Select CSV files’, ‘MultiSelect’, ‘on’);
if isnumeric(filename) % user clicked Cancel
return
end
s=size(filename,2);
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData2=table2array(o(:,2));
fig = figure();
subplot(3,1,1)
p1=plot( cData1,cData2,…
‘Color’, colors{mod(i, numel(colors)) + 1});
hold(‘on’)
end
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData3=table2array(o(:,3));
subplot(3,1,2)
p2=plot( cData1,cData3,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2_2,’on’)
hold(‘on’)
end
%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData4=table2array(o(:,4));
subplot(3,1,3)
p3=plot( cData1,cData4,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2,’on’)
hold(‘on’)
end
b=brush(fig);
b.ActionPostCallback = {@onBrushAction,p1,p2,p3};
% callback function
function onBrushAction(~, eventdata,p1,p2,p3)
set(p1, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p2, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p3, ‘BrushData’, eventdata.Axes.Children.BrushData)
end how can I link subplots (for brush data)?
this is my code :
colors = {‘r’, ‘g’, ‘b’, ‘c’, ‘m’, ‘y’, ‘k’, [0, 0.5, 0.5], [0.5, 0.5, 0], [0, 0.5, 0], [0.5, 0, 0],[0, 0, 0.5], [0.5, 0.5, 0.5],[0.3010 0.7450 0.9330],[0.4660 0.6740 0.1880],[0.4940 0.1840 0.5560],[0.9290 0.6940 0.1250],[0.8500 0.3250 0.0980],[0.6350, 0.0780, 0.1840],[0 0.4470 0.7410] };
[filename,pathname] = uigetfile(‘*.csv’, ‘Select CSV files’, ‘MultiSelect’, ‘on’);
if isnumeric(filename) % user clicked Cancel
return
end
s=size(filename,2);
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData2=table2array(o(:,2));
fig = figure();
subplot(3,1,1)
p1=plot( cData1,cData2,…
‘Color’, colors{mod(i, numel(colors)) + 1});
hold(‘on’)
end
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData3=table2array(o(:,3));
subplot(3,1,2)
p2=plot( cData1,cData3,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2_2,’on’)
hold(‘on’)
end
%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:s
o= readtable(fullfile(pathname,filename{i}));
cData1=table2array(o(:,1));
cData4=table2array(o(:,4));
subplot(3,1,3)
p3=plot( cData1,cData4,…
‘Color’, colors{mod(i, numel(colors)) + 1});
% grid(app.UIAxes2,’on’)
hold(‘on’)
end
b=brush(fig);
b.ActionPostCallback = {@onBrushAction,p1,p2,p3};
% callback function
function onBrushAction(~, eventdata,p1,p2,p3)
set(p1, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p2, ‘BrushData’, eventdata.Axes.Children.BrushData)
set(p3, ‘BrushData’, eventdata.Axes.Children.BrushData)
end plot, brush, link, data MATLAB Answers — New Questions
receiving error when code is correct on matlab onramp Project – Stellar Motion II task 4?
my code:
for v = 1:7
s = spectra(:,v);
if speed(v)<= 0
plot(lambda,s,"–")
else
plot(lambda,s,"–","LineWidth",3)
end
hold on
end
hold off
It says incorrect for "Did you make a plot with seven line?" and I did? How can I fix this?my code:
for v = 1:7
s = spectra(:,v);
if speed(v)<= 0
plot(lambda,s,"–")
else
plot(lambda,s,"–","LineWidth",3)
end
hold on
end
hold off
It says incorrect for "Did you make a plot with seven line?" and I did? How can I fix this? my code:
for v = 1:7
s = spectra(:,v);
if speed(v)<= 0
plot(lambda,s,"–")
else
plot(lambda,s,"–","LineWidth",3)
end
hold on
end
hold off
It says incorrect for "Did you make a plot with seven line?" and I did? How can I fix this? error, onramp MATLAB Answers — New Questions
fftshift implementation in Simulink
I need to generate IPs for HDL implementation of an algorithm. I need to do fftshift in simulink but there is no fftshift block avaiable. Is there any way we can do fftshift of the output data from FFT block from DSP HDL toolbox? I am attaching FFT model for reference.I need to generate IPs for HDL implementation of an algorithm. I need to do fftshift in simulink but there is no fftshift block avaiable. Is there any way we can do fftshift of the output data from FFT block from DSP HDL toolbox? I am attaching FFT model for reference. I need to generate IPs for HDL implementation of an algorithm. I need to do fftshift in simulink but there is no fftshift block avaiable. Is there any way we can do fftshift of the output data from FFT block from DSP HDL toolbox? I am attaching FFT model for reference. fft, fftshift, hdl MATLAB Answers — New Questions
Simulation of a radar altimeter
Hi!
I’m facing a problem in which I need an “intermediate” level of detail for my simulation.
In my case, I’d like to simulate a radar altimeter flying at low altitude over some terrain or sea. Over this surface, suppose to have an obstacle (tree/house/ship/…). I know everything about my altimeter (pulsed radar, frenquency, pulse duration, beam width, …). A possible outcome of such a simulation could be the assessment of the impact of different gain patterns on the received pulse.
What I have always found on the internet are either too simple solution (like solving the radar equations) or too complex (Method of Moments, or similar approaches).
Regarding the radar equation, I have always wandered how it can deal with the echoes coming from the outer regions of the beamwidth of the altimeter antenna (the equation only has the boresight gain as input parameter).
On the other hand, in my opinion, approaches like MoM are really too complicated and beyond my scope.
I had a look and tried to implement some of the Matlab functions that already exist (e.g., the ones on the FMCW Radar Altimeter Simulation example), but I don’t think they meet my needs.
So I decided to try to write my own code, providing the shape of the terrain/sea surface, the shape for the obstacles (for now, just simple shapes)… I guess I’d have to sample the domain, evaluating the echoes for all these elements… however, even in this case there are a lot of parameters that I don’t know how to handle properly, for example:
– is it reasonable to discretize terrain or sea instead of assuming some model for the backscatter?
– how should the domain be discretized?
– how can I guarantee the conservation of power, considering the effects of the radiation pattern of the antenna and the aforementioned discretization of the domain?
Thanks in advance for your support.
Best regards,
AlessandroHi!
I’m facing a problem in which I need an “intermediate” level of detail for my simulation.
In my case, I’d like to simulate a radar altimeter flying at low altitude over some terrain or sea. Over this surface, suppose to have an obstacle (tree/house/ship/…). I know everything about my altimeter (pulsed radar, frenquency, pulse duration, beam width, …). A possible outcome of such a simulation could be the assessment of the impact of different gain patterns on the received pulse.
What I have always found on the internet are either too simple solution (like solving the radar equations) or too complex (Method of Moments, or similar approaches).
Regarding the radar equation, I have always wandered how it can deal with the echoes coming from the outer regions of the beamwidth of the altimeter antenna (the equation only has the boresight gain as input parameter).
On the other hand, in my opinion, approaches like MoM are really too complicated and beyond my scope.
I had a look and tried to implement some of the Matlab functions that already exist (e.g., the ones on the FMCW Radar Altimeter Simulation example), but I don’t think they meet my needs.
So I decided to try to write my own code, providing the shape of the terrain/sea surface, the shape for the obstacles (for now, just simple shapes)… I guess I’d have to sample the domain, evaluating the echoes for all these elements… however, even in this case there are a lot of parameters that I don’t know how to handle properly, for example:
– is it reasonable to discretize terrain or sea instead of assuming some model for the backscatter?
– how should the domain be discretized?
– how can I guarantee the conservation of power, considering the effects of the radiation pattern of the antenna and the aforementioned discretization of the domain?
Thanks in advance for your support.
Best regards,
Alessandro Hi!
I’m facing a problem in which I need an “intermediate” level of detail for my simulation.
In my case, I’d like to simulate a radar altimeter flying at low altitude over some terrain or sea. Over this surface, suppose to have an obstacle (tree/house/ship/…). I know everything about my altimeter (pulsed radar, frenquency, pulse duration, beam width, …). A possible outcome of such a simulation could be the assessment of the impact of different gain patterns on the received pulse.
What I have always found on the internet are either too simple solution (like solving the radar equations) or too complex (Method of Moments, or similar approaches).
Regarding the radar equation, I have always wandered how it can deal with the echoes coming from the outer regions of the beamwidth of the altimeter antenna (the equation only has the boresight gain as input parameter).
On the other hand, in my opinion, approaches like MoM are really too complicated and beyond my scope.
I had a look and tried to implement some of the Matlab functions that already exist (e.g., the ones on the FMCW Radar Altimeter Simulation example), but I don’t think they meet my needs.
So I decided to try to write my own code, providing the shape of the terrain/sea surface, the shape for the obstacles (for now, just simple shapes)… I guess I’d have to sample the domain, evaluating the echoes for all these elements… however, even in this case there are a lot of parameters that I don’t know how to handle properly, for example:
– is it reasonable to discretize terrain or sea instead of assuming some model for the backscatter?
– how should the domain be discretized?
– how can I guarantee the conservation of power, considering the effects of the radiation pattern of the antenna and the aforementioned discretization of the domain?
Thanks in advance for your support.
Best regards,
Alessandro altimeter, backscatter, radar, pulse, antenna, gain, pattern, radiation MATLAB Answers — New Questions
How can I use simulink to solve the algebraic Riccati equation?
Hi,
I need to use simulink to solve the algebraic Riccati equation. How can I do?
I ‘m using the LQR for vibrations control.Hi,
I need to use simulink to solve the algebraic Riccati equation. How can I do?
I ‘m using the LQR for vibrations control. Hi,
I need to use simulink to solve the algebraic Riccati equation. How can I do?
I ‘m using the LQR for vibrations control. riccati, simulink MATLAB Answers — New Questions
java.lang.IllegalArgumentException: NTFS ADS separator (‘:’) in file name is forbidden
When I perform Coder with single precision conversion using fixed point designer, during Mex building, following errors happn.But when I perform Coder without precision conversion, no error happens. How can I fix this problem?
Exception in thread "AWT-EventQueue-0": java.lang.IllegalArgumentException: NTFS ADS separator (‘:’) in file name is forbidden.
at org.apache.commons.io.FilenameUtils.indexOfExtension(FilenameUtils.java:746)
at org.apache.commons.io.FilenameUtils.getExtension(FilenameUtils.java:1069)
at com.mathworks.toolbox.coder.nide.editor.CoderFileBackingStore.<init>(CoderFileBackingStore.java:38)
at com.mathworks.toolbox.coder.nide.editor.CoderFileBackingStore.<init>(CoderFileBackingStore.java:30)
at com.mathworks.toolbox.coder.nide.NideArtifactSet.addSourceArtifact(NideArtifactSet.java:69)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade.updateArtifactSet(CoderNideFacade.java:339)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade.initFilesToModel(CoderNideFacade.java:304)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade.access$800(CoderNideFacade.java:63)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade$4.propertyChange(CoderNideFacade.java:207)
at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
at com.mathworks.toolbox.coder.nide.impl.CoderNideAppModel.fireInputFilesChanged(CoderNideAppModel.java:175)
at com.mathworks.toolbox.coder.nide.impl.CoderNideAppModel.setInputFiles(CoderNideAppModel.java:171)
at com.mathworks.toolbox.coder.wfa.build.VerifyCompatibilityModel$NormalMexBuilder$1.handleFiles(VerifyCompatibilityModel.java:534)
at com.mathworks.toolbox.coder.wfa.build.CoderBuildManager$Handler$1.run(CoderBuildManager.java:250)
at com.mathworks.mwswing.MJUtilities.runOnEventDispatchThread(MJUtilities.java:911)
at com.mathworks.toolbox.coder.wfa.build.CoderBuildManager$Handler.buildFinished(CoderBuildManager.java:247)
at com.mathworks.toolbox.coder.wfa.build.BuildCommand$1$1.run(BuildCommand.java:211)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)When I perform Coder with single precision conversion using fixed point designer, during Mex building, following errors happn.But when I perform Coder without precision conversion, no error happens. How can I fix this problem?
Exception in thread "AWT-EventQueue-0": java.lang.IllegalArgumentException: NTFS ADS separator (‘:’) in file name is forbidden.
at org.apache.commons.io.FilenameUtils.indexOfExtension(FilenameUtils.java:746)
at org.apache.commons.io.FilenameUtils.getExtension(FilenameUtils.java:1069)
at com.mathworks.toolbox.coder.nide.editor.CoderFileBackingStore.<init>(CoderFileBackingStore.java:38)
at com.mathworks.toolbox.coder.nide.editor.CoderFileBackingStore.<init>(CoderFileBackingStore.java:30)
at com.mathworks.toolbox.coder.nide.NideArtifactSet.addSourceArtifact(NideArtifactSet.java:69)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade.updateArtifactSet(CoderNideFacade.java:339)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade.initFilesToModel(CoderNideFacade.java:304)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade.access$800(CoderNideFacade.java:63)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade$4.propertyChange(CoderNideFacade.java:207)
at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
at com.mathworks.toolbox.coder.nide.impl.CoderNideAppModel.fireInputFilesChanged(CoderNideAppModel.java:175)
at com.mathworks.toolbox.coder.nide.impl.CoderNideAppModel.setInputFiles(CoderNideAppModel.java:171)
at com.mathworks.toolbox.coder.wfa.build.VerifyCompatibilityModel$NormalMexBuilder$1.handleFiles(VerifyCompatibilityModel.java:534)
at com.mathworks.toolbox.coder.wfa.build.CoderBuildManager$Handler$1.run(CoderBuildManager.java:250)
at com.mathworks.mwswing.MJUtilities.runOnEventDispatchThread(MJUtilities.java:911)
at com.mathworks.toolbox.coder.wfa.build.CoderBuildManager$Handler.buildFinished(CoderBuildManager.java:247)
at com.mathworks.toolbox.coder.wfa.build.BuildCommand$1$1.run(BuildCommand.java:211)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) When I perform Coder with single precision conversion using fixed point designer, during Mex building, following errors happn.But when I perform Coder without precision conversion, no error happens. How can I fix this problem?
Exception in thread "AWT-EventQueue-0": java.lang.IllegalArgumentException: NTFS ADS separator (‘:’) in file name is forbidden.
at org.apache.commons.io.FilenameUtils.indexOfExtension(FilenameUtils.java:746)
at org.apache.commons.io.FilenameUtils.getExtension(FilenameUtils.java:1069)
at com.mathworks.toolbox.coder.nide.editor.CoderFileBackingStore.<init>(CoderFileBackingStore.java:38)
at com.mathworks.toolbox.coder.nide.editor.CoderFileBackingStore.<init>(CoderFileBackingStore.java:30)
at com.mathworks.toolbox.coder.nide.NideArtifactSet.addSourceArtifact(NideArtifactSet.java:69)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade.updateArtifactSet(CoderNideFacade.java:339)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade.initFilesToModel(CoderNideFacade.java:304)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade.access$800(CoderNideFacade.java:63)
at com.mathworks.toolbox.coder.nide.impl.CoderNideFacade$4.propertyChange(CoderNideFacade.java:207)
at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
at com.mathworks.toolbox.coder.nide.impl.CoderNideAppModel.fireInputFilesChanged(CoderNideAppModel.java:175)
at com.mathworks.toolbox.coder.nide.impl.CoderNideAppModel.setInputFiles(CoderNideAppModel.java:171)
at com.mathworks.toolbox.coder.wfa.build.VerifyCompatibilityModel$NormalMexBuilder$1.handleFiles(VerifyCompatibilityModel.java:534)
at com.mathworks.toolbox.coder.wfa.build.CoderBuildManager$Handler$1.run(CoderBuildManager.java:250)
at com.mathworks.mwswing.MJUtilities.runOnEventDispatchThread(MJUtilities.java:911)
at com.mathworks.toolbox.coder.wfa.build.CoderBuildManager$Handler.buildFinished(CoderBuildManager.java:247)
at com.mathworks.toolbox.coder.wfa.build.BuildCommand$1$1.run(BuildCommand.java:211)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) java.lang.illegalargumentexception, matlab coder MATLAB Answers — New Questions