https://uk.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2020-04-03T11:53:02Ztag:uk.mathworks.com,2005:Question/5150802020-04-03T11:53:02Z2020-04-03T11:53:02Zaccuracy of two methods to solve eignvalues/eignvector problem I am trying to solve an eignvalue/eignvector problem related to the multi-class LDA. The equation is inv(Sw)*Sb. I have two solutions:
[E,D]=eig(inv(Sw)*Sb)
or
[E,D]=eig(Sb,Sw);
when I try them, I get different eignvectors and eignvalues in both cases. Am I supposed to get the same results and what is more accurate to use the first way or the second one? MAhttps://uk.mathworks.com/matlabcentral/profile/authors/15442488-matag:uk.mathworks.com,2005:Question/5150792020-04-03T11:52:28Z2020-04-03T11:52:28Zpost-hoc analysis of two-way repeated measures ANOVA and multcompare() row estimate of Friedman statsIs there a different way of performing a post-hoc analysis on a two-way repeated measures ANOVA other than running a whole bunch of paired t-tests or signrank() tests? Because i've got 2 variables: condition (visual, auditory and audiovisual) and difficulty (easy, intermediate and hard) so a total of 9 different combinations. If i compare all of them to eachother the bonferonni corrected significance level would be 0.05/36 = 0.0014 and that's just too low.
Also, im trying to find out which means per difficulty are significantly different from eachother by using multcompare() on the Friedman stats, but the documentation of multcompare() says that only the columns can be compared. However, the difficulty levels are represented by the rows.
With regards to the multcompare() function, the name-value pair 'Estimate', 'row' is available for the stats resulting from anova2(), but not for the non-parametric two-way repeated measures friedman() analysis. Why?Thomas61197https://uk.mathworks.com/matlabcentral/profile/authors/12563027-thomas61197tag:uk.mathworks.com,2005:Question/5142882020-03-31T12:56:46Z2020-04-03T11:52:14ZDamping and frequency from simulation dataI have some simulation data, for example y in the attachment. I can manually calculate the damping and frequency with logarithmic decrement, but can I do this automated? I can't seem to figure out how.
And/or can I fit a nonlinear function through my datapoints? I tried polyfit but that doesn't work with time series.Mark Markhttps://uk.mathworks.com/matlabcentral/profile/authors/15582688-mark-marktag:uk.mathworks.com,2005:Question/5149132020-04-02T18:25:13Z2020-04-03T11:51:50ZReducing run time for vpasolveHello, I am a very poor coder and need to create a program that solves for the concentration of 3 different chemical species in a set of CSTR reactors either in series or parallel. The concentration depends on the residence time of the reactor. To do this I am using vpasolve to solve my set of kinetic equations, however my program takes too long to run to completetion (not sure on the exact time but I have let it run for 30+ minutes and it has yet to produce a graph. How can I reduce the time it takes to solve the set of equations? Attached is my MATLAB file and below is the text of my code:
function main
CSTRseries
CSTRparallel
end
function CSTRseries
%variables
global k1 k2 k3 k4 Cao Cro Cso
k1=.002777778; %Rate constant (mol/(L*s))
k2=.0002777778; %Rate constant (mol/(L*s))
k3=.0002777778; %Rate constant (mol/(L*s))
k4=.0002777778; %Rate constant (mol/(L*s))
Cao=5; %Initial concentration of A (mol/L)
Cro=0; %Initial concentration of R (mol/L)
Cso=0; %Initial concentration of S (mol/L)
%Solving using the numerical ode solver (numerical solution)
syms Ca Cr Cs
tau=zeros(1,3600);
C=zeros(3,3600);
for i=1:3600
tau(i)=i;
[x,y,z] = vpasolve([(Ca-Cao)==(-k1*Ca + k2*Cr)*tau(i),(Cr-Cro)==(k1*Ca + -k2*Cr + -k3*Cr + k4*Cs)*tau(i),(Cs-Cso)==(k3*Cr + -k4*Cs)*tau(i)],[Ca,Cr,Cs],[0.0000001 Inf;0.00000001 Inf;0.0000001 Inf]);
C(1,i)=x;
C(2,i)=y;
C(3,i)=z;
end
%Plot data
figure(1)
plot(tau,C)
title('CSTRs in Series')
xlabel('tau')
ylabel('Concentration')
legend('A','R','S')
end
function CSTRparallel
%variables
global k1 k2 k3 k4 Cao Cro Cso
k1=.000833333; %Rate constant (mol/(L*s))
k2=.000833333; %Rate constant (mol/(L*s))
k3=.0002777778; %Rate constant (mol/(L*s))
k4=.0002777778; %Rate constant (mol/(L*s))
Cao=5; %Initial concentration of A (mol/L)
Cro=0; %Initial concentration of R (mol/L)
Cso=0; %Initial concentration of S (mol/L)
%Solving using the numerical ode solver (numerical solution)
syms Ca Cr Cs
tau=zeros(1,3600);
C=zeros(3,3600);
for i=1:3600
[x,y,z] = vpasolve([(Ca-Cao)==(-k1*Ca + k2*Cr + -k3*Ca + k4*Cs)*tau(i),(Cr-Cro)==(k1*Ca + -k2*Cr)*tau(i),(Cs-Cso)==(k3*Ca + -k4*Cs)*tau(i)],[Ca,Cr,Cs],[0.0000001 5;0.00000001 5;0.0000001 5]);
C(1,i)=x;
C(2,i)=y;
C(3,i)=z;
end
%Plot data
figure(2)
plot(tau,C)
title('CSTRs in Parallel')
xlabel('tau')
ylabel('Concentration')
legend('A','R','S')
endSamuel Dixonhttps://uk.mathworks.com/matlabcentral/profile/authors/16044617-samuel-dixontag:uk.mathworks.com,2005:Question/5150782020-04-03T11:51:35Z2020-04-03T11:51:35ZOpening a sap2000 model? Hi,
I am trying to open a sap2000.v20 model in matlab. I've already done some search and tried some of the methods presented in answeres to questions of some fellas.
The First method i tried is the one explained here:
https://www.mathworks.com/matlabcentral/answers/499775-how-to-open-an-existing-sap2000-model-file-using-api-in-matlab
and I get this error: "Unable to resolve the name SapModel.File."
And the second one is this:
https://www.mathworks.com/matlabcentral/answers/162113-how-to-use-sap2000-api-matlab
https://www.mathworks.com/matlabcentral/fileexchange/59069-matlab-and-sap2000
for which i got this error: "Server creation failed. Invalid ProgID 'Sap2000v20.SapObject'."
Any help would be really appreciated.
Thanks
Abdelrahman Tahahttps://uk.mathworks.com/matlabcentral/profile/authors/18047252-abdelrahman-tahatag:uk.mathworks.com,2005:Question/5150762020-04-03T11:31:44Z2020-04-03T11:51:31ZPlot with varying legend in for loopI need to do a for loop from -1 to 1 with increments of 0.1 where 0 is neglected. In this plot i create a transfer funciton and i plot the bode plot of if.
I would like to show a legend of a plot containing all the bode plots, with each system being names something like Gp(u1 = value of for loop).
My code looks something like this:
s = tf('s');
for u1 = -1:0.1:1
if u1 == 0
continue
end
Gp1 = tf([rand 1], [rand 1]);
txt = ['Gp, u1 = ',num2str(u1)];
bode(Gp1,'DisplayName',txt)
hold on
end
legend show
This works on a regular plot, but the bode() function does not accomodate the 'DisplayName' function.
How should i do this? I have tried saving the values in an array, but with no luck, as the index need to be positive and an integer.Mads Bildehttps://uk.mathworks.com/matlabcentral/profile/authors/11616475-mads-bildetag:uk.mathworks.com,2005:Question/5150772020-04-03T11:44:41Z2020-04-03T11:44:41ZHow to transform double to unit8for i = 1:1:291 %go through rows
for j = 1:1:240 %columns
img_heq(i, j) = T(img(i,j));
end
end
ERROR: Variable img_heq must be of data type uint8. It is currently of type double.
How to recity the varibale error problem.Sivakumar Rajagopalhttps://uk.mathworks.com/matlabcentral/profile/authors/18036382-sivakumar-rajagopaltag:uk.mathworks.com,2005:Question/971592011-11-22T21:13:00Z2020-04-03T11:43:11ZIs it possible to make the Rate Limiter block in Simulink a variable rate limiter?I have an application where I would like to have a variable rate limiter. Simulink currently has a Rate Limiter block in the Discontinuities library. This block limits the falling and rising rates of signals. I would like the flexibility of having two extra inputs to this block where the rising and falling slew rates are variables.
MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/1003832009-06-27T01:11:00Z2020-04-03T11:43:10ZWhy can't I use Santa Barbara ST7 or Starlite Express SXV 9 cameras with the Image Acquisition Toolbox 1.8 (R14SP2)?I would like to use Santa Barbara ST7 Series and Starlite Express SXV 9 cameras with the Image Acquisition Toolbox 1.8 (R14SP2).
MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/1103362013-11-19T05:00:00Z2020-04-03T11:43:08ZHow do I install MATLAB Production Server or configure a new MATLAB Production Server Instance?How do I install MATLAB Production Server or configure a new MATLAB Production Server Instance?
MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/5119112020-03-20T11:36:26Z2020-04-03T11:42:42ZHow to resolve an internet connexion error when installing MatLab Standard ?After executing the matlab_R2020a_win64.exe, the setup.exe in the temporary file can't execute and briefly shows me the following error :
Unable to open the requested feature. Check your internet connection and proxy settings in MATLAB Web preferences and then try starting the feature again.
Error code: -6
Error message: ERR_FILE_NOT_FOUND
I tried deactivating my firewall and my antivirus, but it didn't work. I am using ethernet connexion at home.
I also tried with previous version but I have the same problem.
How can I solve this issue ?Laurent Beaupoilhttps://uk.mathworks.com/matlabcentral/profile/authors/17305818-laurent-beaupoiltag:uk.mathworks.com,2005:Question/5150192020-04-03T04:58:39Z2020-04-03T11:40:17Ztrplot function doesn't show one of the axis i'm trying to draw three axis and rotate them via rotx and roty functions
but when i plot them one of the axis disappears
plus whenever i change the angle inside rotx the graph
rotx(angle)
R1=eye(3);
figure
R1=R1*rotx(pi/2);
trplot(R1,'axis',[0 1 -1 0 0 1])
Hassan Boshahttps://uk.mathworks.com/matlabcentral/profile/authors/14798685-hassan-boshatag:uk.mathworks.com,2005:Question/5150122020-04-03T03:57:53Z2020-04-03T11:34:12ZArea under FFT curveI need to calculate the area under each some harmonics in an FFT curve. I tried to use trapz function but I am getting a negative value. Nasrin Akterhttps://uk.mathworks.com/matlabcentral/profile/authors/11400482-nasrin-aktertag:uk.mathworks.com,2005:Question/5144162020-03-31T21:01:44Z2020-04-03T11:33:48Zbvp4c: Too many input arguments errorI need to solve two differential equations of the first order, with one unknown parameter in each equation, and I have four boundary conditions. My function for guessing solution is pinit:
function pinit = mat4init(z)
pinit = [ 0.65.*cos(z)
0.65.*cos(z) ];
end
I also have function for boundary condtions mat4bc:
function res = mat4bc(pa, pb)
res = [ pa(1,:)-8
pb(1,:)-1
pa(2,:)
pb(2,:) ];
end
where with index 1 are boubdary conditions for the first equation. Unknown parameters are m0, and m1, and I am guessing it bellow, and bellow in matrix4ode function are given also differential equations :
function dpdz = matrix4ode(z, p)
m0 = 2;
m1 = 1;
z = linspace(0,pi,10);
ri = 0.7;
R = ri - z .* (ri - 1);
beta = 1;
dpdz = zeros(2, size(z,2));
dpdz(1,:) = - 32 .* beta .* m0 ./ (R .^ 4 .* p(1,:));
dpdz(2,:) = -( - 8 .* dpdz(1,:) ./ R - dpdz(1,:) .* p(2,:) - 32 .* beta .* m1 ./ R .^ 4 ) ./ p(1,:);
end
And I am using bvpinit with this command:
solinit = bvpinit(linspace(0,pi,10),@mat4init , [2 1]);
and after that calling bvp4c with code:
m0 = 2;
m1 = 1;
z = linspace(0,pi,10);
ri = 0.7;
R = ri - z .* (ri - 1);
beta = 1;
sol = bvp4c(@matrix4ode,@mat4bc,solinit);
I got error:
Error using matrix4ode
Too many input arguments.
Error in bvparguments (line 105)
testODE = ode(x1,y1,odeExtras{:});
Error in bvp4c (line 130)
bvparguments(solver_name,ode,bc,solinit,options,varargin);
How when I have not additional input arguments in matrix4ode function? What should I do?I Ghttps://uk.mathworks.com/matlabcentral/profile/authors/8632768-i-gtag:uk.mathworks.com,2005:Question/5150522020-04-03T09:10:36Z2020-04-03T11:33:35ZHow to pass the same function to different columns?I would like to pass the same function to all the columns of an object.
I tried this code but it doesn't work
for j = 1:3
autocorr(VAR.res(:,j))
end
where basically I wanted to tell MATLAB "compute autocorrelation for all the 3 columns of VAR.res".
What did I do wrong?
ThanksArmando MAROZZIhttps://uk.mathworks.com/matlabcentral/profile/authors/17653517-armando-marozzitag:uk.mathworks.com,2005:Question/5150432020-04-03T08:22:19Z2020-04-03T11:32:43ZFind the actual locations from imageFiltering with 2d imageI have 2D image which is being plotted accordingly
x = -100:100; % dummy data taken
y = -100 :100; % dummy data taken
x_grid = ((min(x)/0.25)-1:max(x)/0.25+1)* 0.25; % defining the grid scale of 0.25
y_grid = ((min(y)/0.25)-1:max(y)/0.25+1)* 0.25;% defining the grid scale of 0.25
numPointGrid = histcounts2(x,y,x_grid,y_grid); % finding the number of xy locations available in each grid
image(numPointGrid) % plotting the 2d image
filt_img = imfilter(numPointGrid, fspecial('disk',2));
question:
is it possible to extract the x,y coordinates from numPointGrid or from filt_img? if so how ?
thank you
SatyaPrakash Guptahttps://uk.mathworks.com/matlabcentral/profile/authors/16893253-satyaprakash-guptatag:uk.mathworks.com,2005:Question/5148442020-04-02T13:25:57Z2020-04-03T11:29:48ZHow to concatenate different rows Hello, i have some trouble doing my project. I have 2 different mat file (skak1.mat with 268x1000000 dimension and skak2.mat with 63x1000000 dimension) I want to concatenate 2 files above. Anyone can help me please?Della Nhttps://uk.mathworks.com/matlabcentral/profile/authors/17665609-della-ntag:uk.mathworks.com,2005:Question/4897002019-11-06T05:00:00Z2020-04-03T11:28:46ZIs MATLAB compatible with macOS Catalina?Does MATLAB support macOS Catalina (10.15)?
MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/5149272020-04-02T19:44:21Z2020-04-03T11:28:22ZFaster finding of 1D linear interpolation nodes and weights for each element in ND matrixIn a problem I'm working on now, I compute some values in a matrix x and I then for each element in x need to find the index of the closest element below in a monotonically increasing vector X as well as the relative proximity of the x elements to the first elements on their either side. (This is essentially linear interpolation without doing the actual interpolation.) I'm doing this maaaany times so I really super extra interested in it being as fast as possible.
I have written a function `locate` that I can call with some example data:
X = linspace(5, 300, 40);
x = randi(310, 5, 6, 7);
[ii, weights] = locate(x, X);
I have written two versions of locate. The first is for exposition and the second is my best attempt at speeding up the computations. Do you have any suggestions or alternative approaches for how I could accelerate performance further?
1. Exposition
function [ii, weights] = locate(x, X)
% LOCATE Locate first node on grid below a given value.
%
% [ii, weights] = locate(x, X) returns the first node in X that is below
% each element in x and the relative proximities to the two closest nodes.
%
% X must be a monotonically increasing vector. x is a matrix (of any
% order).
% Preallocate
ii = ones(size(x)); % Indices of first node below (or 1 if no nodes below)
weights = zeros([2, size(x)]); % Relative proximity of the two closest nodes
% Find indices and compute weights
for ix = 1:numel(x)
if x(ix) <= X(1)
ii(ix) = 1;
weights(:, ix) = [1; 0];
elseif x(ix) >= X(end)
ii(ix) = length(X) - 1;
weights(:, ix) = [0; 1];
else
ii(ix) = find(X <= x(ix), 1, 'last');
weights(:, ix) = ...
[X(ii(ix) + 1) - x(ix); x(ix) - X(ii(ix))] / (X(ii(ix) + 1) - X(ii(ix)));
end
end
end
2. Best attempt
function [ii, weights] = locate(x, X)
% LOCATE Locate first node on grid below a given value.
%
% [ii, weights] = locate(x, X) returns the first node in X that is below
% each element in x and the relative proximities to the two closest nodes.
%
% X must be a monotonically increasing vector. x is a matrix (of any
% order).
% Preallocate
ii = ones(size(x)); % Indices of first node below (or 1 if no nodes below)
weights = zeros([2, size(x)]); % Relative proximity of the two closest nodes
% Find indices
for iX = 1:length(X) - 1
ii(X(iX) <= x) = iX;
end
% Find weights
below = x <= X(1);
weights(1, below) = 1; % All mass on the first node
weights(2, below) = 0;
above = x >= X(end);
weights(1, above) = 0;
weights(2, above) = 1; % All mass on the last node
interior = ~below & ~above;
xInterior = x(interior)';
iiInterior = ii(interior);
XBelow = X(iiInterior)';
XAbove = X(iiInterior + 1)';
weights(:, interior) = ...
[XAbove - xInterior; xInterior - XBelow] ./ (XAbove - XBelow);
end
Fredrik Phttps://uk.mathworks.com/matlabcentral/profile/authors/6651388-fredrik-ptag:uk.mathworks.com,2005:Question/4831382019-10-02T00:33:18Z2020-04-03T11:26:53ZPlot legend does not display any linesHi,
I am plotting a simple graph from a matrix, but when I code as below, the legend does not show any lines, but shows legend names only.
plot(kmat,v(:,1))
title('Convergence of Value Functions')
xlabel('k')
ylabel('v(k)')
hold on
plot(kmat,v(:,5))
plot(kmat,v(:,50))
plot(kmat,v(:,1000))
legend('iter=1','iter=5','iter=50','iter=1000')
hold off
"kmat" is N x 1 matrix for x-axis value, and "v" is N x N matrix where i want to plot values on y-axis.
However, as you can see from the plot below, the legend displays its names but doesn't display any corresponding line.
DoubleDhttps://uk.mathworks.com/matlabcentral/profile/authors/14532320-doubledtag:uk.mathworks.com,2005:Question/5150752020-04-03T11:21:23Z2020-04-03T11:21:23ZDiode Power losses in Simscape ElectricalHi,
following my previous question on Power losses in Simscape Electrical, the only way to calculate the power losses in a three phase inverter is to split IGBT module on IGBT and Diode and calculate losses for each component separately. And then for each component use separate thermal element as IGBT and Diode have different junction to case resistance. Only at case to heatsink losses ca be combined. Please confirm is this assumption is correct!
Now, I have the question what element to use for Diode? There is no explanation on how the power losses are calculated for Diode. Theory says there are conduction and switching losses. For conduction losses I see entry points for If and Vf, but for switching losses I cannot see where to enter Err, i.e. switching energy. How accurate is the final result? In IGBT module diode switching (reverse recovery) losses cannot be ignored and they are even higher that conduction losses.
Kind regardsIgorhttps://uk.mathworks.com/matlabcentral/profile/authors/6512418-igortag:uk.mathworks.com,2005:Question/5150612020-04-03T10:10:28Z2020-04-03T11:21:15ZHow to solve system of differential equations with time dependent parameters?Hello, I'm quite new to MATLAB and I'm having a problem when trying to solve the next system of differential equations for the case when Dw and w1 vary with time.
For the case when w1 and Dw are constants the code works just fine with dsolve.
If I add the time dependent functions w1 and dw my code looks like:
%define constants
T1 = 0.6;
T2 = 0.1;
gamma = 4258;
dt = 0.0001;
Tp = 0.008;
Ns = Tp/dt;
B1 = 20;
f = 1200;
mu=6;
%define time dependent functions
syms t
w1 = @(t) B1*sech((pi*f/mu)*(t-Tp));
dw = @(t) pi*f*tanh((pi*f/mu)*(t-Tp));
syms x(t) y(t) z(t)
eqns = [diff(x(t),t) == -x(t)/T2 + dw(t)*y(t), diff(y(t),t) == -dw(t)*x(t) - y(t)/T2 + w1(t)*z(t),diff(z(t),t) == -w1(t)*y(t) - (z(t)-1)/T1];
cond = [x(0) == 0, y(0) == 0, z(0) == 1];
[xSol(t),ySol(t),zSol(t)] = dsolve(eqns,cond);
And I get the error:
Warning: Unable to find explicit solution.
> In dsolve (line 201)
Error using sym/subsindex (line 825)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.
I also tried with ODE45 but I get a similar error. Apparently I am not using the correct syntax. I read all the mathlab helps I could find but I didn't find an answer useful for this case.
Thanks for your help.Milena Capiglionihttps://uk.mathworks.com/matlabcentral/profile/authors/17515622-milena-capiglionitag:uk.mathworks.com,2005:Question/5150532020-04-03T09:23:56Z2020-04-03T11:20:48ZLegend of a patch-object with a line in the centerHi,
I am looking for a way to have a custom legend entry for a filled area plot along with a line plot where the individual legend entries would be combined into one entry. The single entry should have the line marker overlaid on top of the box of the filled area legend. Is this possible?
x = [0 1];
y = [1 0];
xArea = [x, fliplr(x)];
yArea = [y + 1, fliplr( y - 1 )];
figure();
hold on;
hp = plot( x, y);
hp.LineWidth = 2;
hp.HandleVisibility = 'off';
hf = fill( xArea, yArea, [0, 0.4470, 0.7410]);
hf.FaceAlpha = 0.25;
hf.LineStyle = 'none';
hLeg = legend('Single legend entry');
hLeg.FontSize = 30;
Result of the example code:
Desired look of the legend entry:
Teemu Harkonenhttps://uk.mathworks.com/matlabcentral/profile/authors/8017168-teemu-harkonentag:uk.mathworks.com,2005:Question/5150362020-04-03T07:19:04Z2020-04-03T11:18:26ZBar Chart with different colors - Dependent on a additional informationHello!
I've created this bar chart and now like to colour different values with different colours depending on the type to which they belong.
Every y-value has an additional information from which type the value is,
e.g. first value - type 1,
second value - 2,
third value - 1
fourth - 3
My suggestion was:
figure
hold on
for i = 1:length(l)
h = bar (y)
if l(i) == 1
set (h, 'Facecolor', 'k')
elseif l(i) == 2
set (h, 'Facecolor', 'r');
else
set (h, 'Facecolor', 'b');
end
end
y is the array with all the y-values and
l is the array containing all the types (already in the right order).
So the two arrays have the same size.
But the result won't be in different colours.
Can anyone help?
SophiaSophia Bitterwolfhttps://uk.mathworks.com/matlabcentral/profile/authors/17995523-sophia-bitterwolftag:uk.mathworks.com,2005:Question/5150732020-04-03T11:11:27Z2020-04-03T11:18:05ZSeries Load Resonant ConverterHi,
I have a question about Series Load Resonant Converter example (https://www.mathworks.com/help/physmod/sps/examples/series-load-resonant-slr-converter.html).
In Continuous Conduction Mode 2 (CCM2), when turning on MOSFET I think there is ZVS and ZCS, but in the description of this example they say it's only ZVS. In the figure below it can be seen when FET is turned on it's current is zero, so shouldn't it be ZVS and ZCS? Maybe I don't understand something about ZVS and ZCS.
One more question, about this sentence:
"Observe the DC gain characteristic plot (0.5 Ohm traces), you will note that the experimental gain values are slightly shifted relative to the theoretical gain values."
How can I obtain experimental gain values?
Thank you,
KarlaKarla Drazenovichttps://uk.mathworks.com/matlabcentral/profile/authors/9181942-karla-drazenovictag:uk.mathworks.com,2005:Question/5150552020-04-03T09:44:36Z2020-04-03T11:16:22ZError in my functionHey, i wanna make a time vector of my data.
I have written this function:
function [ data_out_time ] = create_time( header_out , data_out_norm )
%% Create a time vector
% by reading the sampling interval of a measurement in the file
le= size(data_out_norm,1); % find out length of my cutted data matrix
% there may be a comma for decimal seperator
% -> search for it and replace it by a dot, otherwise the interval will be incorrect!
str_interval = strrep(header_out{1 , 1},',','.');
% convert sample time:
interval = str2double(str_interval); % from string to double
% Check if sample time is in range of t > 0
if interval<=0
error('incorrect sampling interval'); % Display error message in this case
end
%create output matrix
data_out_time = zeros(le,1); % prelocating matrix for performance
for r = 1:1:le % loop for generating time vector
data_out_time(r) = interval * (r-1); % time has to start at 0 -> *(r-1)
end
But i get everytime this error:
Brace indexing is not supported for variables of this type.
Error in create_time (line 9)
str_interval = strrep(header_out{1 , 1},',','.');
Where is the problem? My Data has the class "table"Mark Fhttps://uk.mathworks.com/matlabcentral/profile/authors/17174508-mark-ftag:uk.mathworks.com,2005:Question/5150742020-04-03T11:13:00Z2020-04-03T11:13:00ZGet all pairs from a 2D matrix in columns (CSV)Given a matrix 3x4 like this one:
a = [ 12 34 25 23
76 12 8 59
23 56 89 61]
I would like to export it to a csv file like this (including the first 2 columns as row x column indexes from 2 other matrixes):
rows = [56 12 90]
columns = [4 2 8 1]
CSV:
56,4,12
56,2,34
56,8,25
56,1,23
12,4,76
..
I'm new to matlab, any ideas?
I have tried this:
A = A([1:3 1:end]);
A = permute(A,[2 1]);
csvwrite("test.csv",A);
Which works for matrix A, but I'm unable so far to put together the other 2 matrixes into columns 1, 2 as in the example above.
Thanks in advance,jose sanchezhttps://uk.mathworks.com/matlabcentral/profile/authors/15109992-jose-sancheztag:uk.mathworks.com,2005:Question/3716192017-12-07T10:00:13Z2020-04-03T11:11:36ZUndefined variable "rmiut" or class "rmiut.isBuiltinNoRmi"This happens when I try to call and execute a simulation in parallel mode 'parfor' instead of normal 'for' mode?
I guess is something to do with the settings of the simulation like:?
options = simset('SrcWorkspace','current')
sim(mdl,[0 Z_t_End],options);Paul Smithhttps://uk.mathworks.com/matlabcentral/profile/authors/4559257-paul-smithtag:uk.mathworks.com,2005:Question/5143152020-03-31T14:25:02Z2020-04-03T11:09:29ZFill command issue for time seriesI am trying to fill the space in between two lines on a time series
I have created a 45x1 cell array of datenum variables (X), a 45x1 cell array for the blue line (Y1) and a 45x1 cell array for the red line (Y2)
The plot of these two lines can be seen in the attatched image 'Lines'
I want to fill in the space in between these lines
However, when I use the following script, the space in between the lines does not fill - as seen in the image 'Fill'. What am I doing incorrectly?
>> plot(X, Y1, 'b', X, Y2, 'r')
>> hold on
>> fill([X fliplr(X)],[Y1 fliplr(Y2)],'c')William Garretthttps://uk.mathworks.com/matlabcentral/profile/authors/16620309-william-garretttag:uk.mathworks.com,2005:Question/5150722020-04-03T11:09:28Z2020-04-03T11:09:28ZNetwork Analysis and VisualizationHello
I need to compute a Planar Maximally Filtered Graph. How can I do?Tugce Elver Bozhttps://uk.mathworks.com/matlabcentral/profile/authors/18033765-tugce-elver-boztag:uk.mathworks.com,2005:Question/5150692020-04-03T10:52:08Z2020-04-03T11:05:16Zhow to plot an image and a logical matrix on same plotHi,
I have an image in a matrix (uint 16) and a matrix that contain the border of a mask that i have done to the image. i want to plot the image and the mask together, so i can plot them together and see them both.
the two images are in the attached file.
when im plotting them together, i only see one of the pictures (using hold on). The problem is that the logical matrix is max 1 and the image matrix getting different values grater than 1 so i dont see it. I want it ti be like a line in different color on the image that represent real data.
thanks in advance.Idan Golcmnhttps://uk.mathworks.com/matlabcentral/profile/authors/12420552-idan-golcmntag:uk.mathworks.com,2005:Question/4639492019-05-25T04:08:12Z2020-04-03T11:04:04ZCalculate taxi fare by giving multiple inputs and single outputWrite a function called taxi_fare that computes the fare of a taxi ride. It takes two inputs: the distance in kilometers (d) and the amount of wait time in minutes (t). The fare is calculated like this:
the first km is $5
every additional km is $2
and every minute of waiting is $0.25.
Once a km is started, it counts as a whole (Hint: consider the ceil built-in function). The same rule applies to wait times. You can assume that d >0 and t >= 0 but they are not necessarily integers. The function returns the fare in dollars. For example, a 3.5-km ride with 2.25 minutes of wait costs $11.75. Note that loops and if-statements are neither necessary nor allowed.Divyang Jainhttps://uk.mathworks.com/matlabcentral/profile/authors/14232458-divyang-jaintag:uk.mathworks.com,2005:Question/5150712020-04-03T11:03:31Z2020-04-03T11:03:31ZZero crossing for a curve fitting function(smoothing spline)Hello,
I want find the zero-crossings of a smoothing spline function that I got using the Curve Fitting toolbox and plot the points were this occurs. The function code is the following:
%% Fit: 'Jan 2012'.
[xData, yData] = prepareCurveData( x_jan_12_s, Price_jan_12_s );
% Set up fittype and options.
ft = fittype( 'smoothingspline' );
excludedPoints = excludedata( xData, yData, 'Indices', [2 276] );
opts = fitoptions( 'Method', 'SmoothingSpline' );
opts.SmoothingParam = 8.24530273269464e-08;
opts.Exclude = excludedPoints;
% Fit model to data.
[fitresult{2}, gof(2)] = fit( xData, yData, ft, opts );
% Plot fit with data.
figure( 'Name', 'Jan 2012 Supply France Peak' );
plot( fitresult{2}, 'k');
% Label axes
xlabel( 'Volume [MWh]', 'Interpreter', 'none' );
ylabel( 'Price', 'Interpreter', 'none' );
I found the link where @Star Strider answers a similar question https://www.mathworks.com/matlabcentral/answers/267222-easy-way-of-finding-zero-crossing-of-a-function
However with his code, you need to define the y, which is not available for my fit curve (y is contained in fitresult{2}):
t = [1:0.01:5]; % Time Vector
y = sin(2*pi*t); % Signal
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0); % Returns Zero-Crossing Indices Of Argument Vector
zx = zci(y); % Approximate Zero-Crossing Indices
figure(1)
plot(t, y, '-r')
hold on
plot(t(zx), y(zx), 'bp')
hold off
grid
legend('Signal', 'Approximate Zero-Crossings')
How can I solve the problem?
Thanks in advance!
Angelavtchttps://uk.mathworks.com/matlabcentral/profile/authors/17242946-angelavtctag:uk.mathworks.com,2005:Question/5148282020-04-02T12:26:24Z2020-04-03T11:02:50ZReading Workspace variable into csv file
I got above 22 side bands output from 3D DWT, which are represented in the form of matrix. I need to read this into the csv file. Can anyone help me out??? Mehul Jainhttps://uk.mathworks.com/matlabcentral/profile/authors/14926830-mehul-jaintag:uk.mathworks.com,2005:Question/5150702020-04-03T11:00:10Z2020-04-03T11:00:10Ztransformation d'une image de 8bits par une image de 4bit,Bonjour,
j'ai besoin d'une code au Matlab qui diviser le nombre de bits d'un pixelde 8bits à 4bit pour chaque pixels
par exemple.
nbre de bits de pixel (8bits)= 10110011., ce pixel la va transforme par deux pixel et pour chaque pixel contient de 4 bits.
first pixels (1011) and second pixels(0011).
thankslahssan oukhouya alihttps://uk.mathworks.com/matlabcentral/profile/authors/10087240-lahssan-oukhouya-alitag:uk.mathworks.com,2005:Question/3449412017-06-15T19:32:49Z2020-04-03T10:59:13ZI want to remove small spots from a greyscale image without affecting the rest of the image See the attached image for reference. I want to remove the white spot encircled in the image without affecting much the rest of the image. I dont mind losing the dot smaller than the one in the circle but nothing bigger.
I tried bwareaopen but it converts my image to binary which I do not want! I want to keep it in grayscale but remove the dots. thanks for any help!
Naimhttps://uk.mathworks.com/matlabcentral/profile/authors/6260814-naimtag:uk.mathworks.com,2005:Question/5144692020-04-01T03:58:45Z2020-04-03T10:56:30ZHow to remove or exclude the intersecting part from two intersecting or overlaping spheres using Matlab?Hi everyone,
i have two spheres of radii R1 and R2 with centers C1 and C2 intersecting each others. i want to exclude the intersecting part. How to remove it to get new object like peanut. i used following code to get interseting spheres.
% spheres S1 with radius R1 and centre C1.
R1 =10; R2 = 13; C1=[10 12 14]; C2=[16 18 20];
numPoints = 10000;
r = randn(3, numPoints);
r = bsxfun(@rdivide, r, sqrt(sum(r.^2,1)));
r = R1 * r;
% Extract the x, y, and z coordinates from the array.
x1=C1(1,1);
y1=C1(1,2);
z1=C1(1,3);
x = r(1,:) +x1 ; % Extract x from row #1.
y = r(2,:)+ y1; % Extract y from row #2.
z = r(3,:)+ z1; % Extract z from row #3.
% Display the shell of points
figure(1)
scatter3(x, y, z);
axis square;
xlabel('X', 'FontSize', 20);
ylabel('Y', 'FontSize', 20);
zlabel('Z', 'FontSize', 20);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% spheres S1 with radius R1 and centre C1.
numPoints = 10000;
% Get a 3-by-numPoints list of (x, y, z) coordinates.
r = randn(3, numPoints);
r = bsxfun(@rdivide, r, sqrt(sum(r.^2,1)));
r = R2 * r;
%C2= input('Centre of sphere 2 = ')
x2 = C2(1,1);
y2 = C2(1,2);
z2 = C2(1,3);
x = r(1,:) + x2; % Extract x from row #1.
y = r(2,:) + y2; % Extract y from row #2.
z = r(3,:) + z2; % Extract z from row #3.
% Display the shell of points
hold on
scatter3(x, y, z);
axis square;
xlabel('X', 'FontSize', 20);
ylabel('Y', 'FontSize', 20);
zlabel('Z', 'FontSize', 20);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
hold off
% i got the following shape. M.S. Khanhttps://uk.mathworks.com/matlabcentral/profile/authors/13647580-m-s-khantag:uk.mathworks.com,2005:Question/5140482020-03-30T16:50:40Z2020-04-03T10:56:19ZMatlab R2019b gets stuck and is not responding when open in macOS 10.15.4I update macOS to 10.15.4 but when I open the Matlab R2019b, it gets stuck and becomes no responding all the time.
Is there any compatibility problems between R2019b and 10.15.4?Li Hanghttps://uk.mathworks.com/matlabcentral/profile/authors/17786616-li-hangtag:uk.mathworks.com,2005:Question/5150662020-04-03T10:30:04Z2020-04-03T10:49:00Zhelp on import caffe networkProblem:
I am trying to import a caffe network (https://github.com/WHUQZhang/PSTCR/blob/master/Def/Model.prototxt) to matlab and got the following error:
>> importCaffeLayers('model.prototxt')
Error using nnet.internal.cnn.caffe.CaffeModelReader/makeAdditionLayer (line 1295)
The layer 'anti_mask' specifies an unsupported element-wise operation. Only addition is supported.
Error in nnet.internal.cnn.caffe.CaffeModelReader/importLayers (line 287)
layers(layerIdx) = makeAdditionLayer(this, origLayerIdxInFile);
Error in importCaffeLayers (line 73)
layers = importLayers(readerObj);
Question:
I learnt deep learning via matlab and have no knowledge about caffe at all. But it seems that the problem is caused by the last layer of the caffe model:
layer {
name: "anti_mask"
type: "Eltwise"
bottom: "conv11"
bottom: "data_3"
top: "anti_mask"
eltwise_param {
operation: PROD
}
}
It seems to me that the above layer is to do a pixel-wise multiplication. I assume that Matlab should be able to easily support that. Would you please help how to get around this issue? Qi Chenhttps://uk.mathworks.com/matlabcentral/profile/authors/7104304-qi-chentag:uk.mathworks.com,2005:Question/3022912016-09-07T19:20:34Z2020-04-03T10:45:37ZWrite a function called halfsum that takes as input an at most two-dimensional array A and computes the sum of the elements of A that are in the lower right triangular part of AWrite a function called halfsum that takes as input an at most two-dimensional array A and
computes the sum of the elements of A that are in the lower right triangular part of A, that is,
elements in the counter-diagonal (going from the bottom left corner, up and to the right) and
elements that are to the right of it. For example, if the input is [1 2 3; 4 5 6; 7 8 9], then
the function would return 38.
This is all I have so far:
function sum=halfsum(v)
sum=0;
[row col]=size(v);
for i= 1:row;
for j=1:col;
I have spent hours on trying to figure out how to sum the reverse diagonal starting at the bottom left element and everything to the right of it and cannot seem to figure it out. Any help is greatly appreciated!Will Gotcherhttps://uk.mathworks.com/matlabcentral/profile/authors/8547545-will-gotchertag:uk.mathworks.com,2005:Question/5147342020-04-02T01:20:32Z2020-04-03T10:38:49ZAdd row name from uitable to excelHello,
I figured out how to export 'ColumnNames' from uitable to Excel Spreadsheet.
But how would I do the same for 'RowNames'?
Any help will be appreciated.
Thank you!
Miss Bhttps://uk.mathworks.com/matlabcentral/profile/authors/14395378-miss-btag:uk.mathworks.com,2005:Question/5138962020-03-30T09:05:19Z2020-04-03T10:34:37Zinflow: weekly to hourly, linear interpolationHey everybody! I bit confusing, I believe I have a fundamental wrong understanding of my math.
How do I calculate hourly water inflow from weekly inflow?
background: I am working on an optimisation problem and all my data (price, wind, solar) is in hourly timesteps, just my inflow is weekly. I got weekly inflow data (see code), e.g., in week 2 --> 232 million m3 water flow into a certain reservoir.
If I were to calculate a step-interpolation (every hour the same amount of water), it would be 1.38 million m3 / per hour (168*1.38 = 323). Whats about linear interpolation? I tried the build-in interpl function, but received the y-axis point of the graph, not the actual inflow. E.g., in [hour = inflow] hour 167 = 231.9464, hour 168 = 232, hour 169 = 232.0535 - which is wrong because the oveerall weekly inflow would be much greater than 323. I tried to subtract the weekly inflow (e.g., 232) from the calculated value, but even then I get the wrong overall inflow (e.g., 750 milliom m3). Remeber, the overall inflow in week two should be 323 million m3. I searched answers and found a bit on temperature or index values, where interpolation in the way I did below makes sense. But, with the extra constraint that the sum of hourly inflows needs to be the weekly inflow, I cannot get my head around.
How do I calculate a linear or even a spline interpolated inflow of each hour?
clear all var
%hourly inflow
inflow_weekly = [223 232 241 437 308 246 192 77 62 59 63 53 86 129 328 1626 1439 1189 3849 2463 1798 1956 1181 1376 902 445 308 209 188 241 690 1118 1430 854 626 1321 2858 2426 1881 1123 1918 888 1132 503 957 1259 245 465 433 153 203 362];
%time set
t = 1:168:52*168 ;
% interpolation
ti = 1:1:52*168 ;
inflow_hourly = interp1(t,inflow_weekly,ti) ;
%graph
plot(t,inflow_weekly,'.-r')
hold on
plot(ti,inflow_hourly,'b')
legend('Original', 'interpolated')
Here is the inflow as well as the interpolated inflow.
Jon Jaehttps://uk.mathworks.com/matlabcentral/profile/authors/17530830-jon-jaetag:uk.mathworks.com,2005:Question/5150682020-04-03T10:33:16Z2020-04-03T10:33:16ZWhy am I getting compile errors when deploying a matlab function that uses snapshot() from raspberry pi cameraboard together with deep learning?I have two sections in my function. First, it captures an image from the raspberry pi camera module. Deploying it to the hardware as standalone was successful. Then I added another set of code — using AlexNet to classify the captured image. However, when I tried to deploy it in the hardware after making the necessary changes in coder.DeepLearningConfig() (a new feature in MATLAB 2020a), it yielded this error:
error: cannot convert ‘uint64m_T*’ to ‘uint64_t’ for argument ‘1’ to ‘int EXT_CAMERABOARD_snapshot (uint64_t*, uint8_T8*, uint32_T*)’
.
.
.
recipe for target 'cameraboard.cpp.o' failed
It seems like there was a problem with compiling the cameraboard when using it with deep learning models. To check that there was really no problem with AlexNet, I tried deploying it without the cameraboard and it worked. Are there any fixes for this? Miguel Doradohttps://uk.mathworks.com/matlabcentral/profile/authors/16534405-miguel-doradotag:uk.mathworks.com,2005:Question/5150492020-04-03T08:54:45Z2020-04-03T10:33:15ZExtract rows from table fullfilling the condition of intervalProblem with measured data from service software in log. I am able to read these log files
data = readtable('wimodlr_rlt_2019-12-09_09-46-07_LoRa SF12_LoRa BW 1600')
and i need to extract the rows according to % of PER. But these numbers are in this format:
data =
169×7 table
No_ Port HostTime DnLnkTx DnLnkRx DnLnkPER PeerRSSI
___ ________ ___________________ _______ _______ ___________ ___________
136 {'COM4'} 2019-12-09 09:47:08 136 125 {'8.09 %' } {'-65 dBm'}
137 {'COM4'} 2019-12-09 09:47:09 137 125 {'8.76 %' } {'-65 dBm'}
138 {'COM4'} 2019-12-09 09:47:09 138 125 {'9.42 %' } {'-65 dBm'}
139 {'COM4'} 2019-12-09 09:47:09 139 125 {'10.07 %'} {'-65 dBm'}
140 {'COM4'} 2019-12-09 09:47:10 140 125 {'10.71 %'} {'-65 dBm'}
141 {'COM4'} 2019-12-09 09:47:10 141 125 {'11.35 %'} {'-65 dBm'}
I need to filter only rows which fullfill the requirement for example: DnLNkPER<10% and DnLNkPER>9% with conversion of strings to double.Filip Kauciarikhttps://uk.mathworks.com/matlabcentral/profile/authors/18038143-filip-kauciariktag:uk.mathworks.com,2005:Question/5148862020-04-02T16:30:09Z2020-04-03T10:32:43ZUse findpeak in for loop with conditionsA=[5 17 13 7 21 1 15 2 25 2 1 24 1 26 11 3 34 56 76 11 2 13 14 7 4 45 14 23 14 26];
B = [14 10 16 17 12];
[x y]=size(A);
i = 1;
for j = 1:length(B)
for i = 1:x
[a{i}, b{i}]=findpeaks(A(i,:),'MinPeakHeight',B(j));
end
end
a_P = cell2mat(a)
b_L = cell2mat(b)
I want to find a maximum value in A after every 5 values. Vector B is threshold condition which I'm using as 'MinPeakHeight'
Example:
A [5 17 13 7 21] for this slot 'MinPeakHeight' should be 14
Answer: [a{i} , b{i}] = [{17 21},{2 5}]
A [1 15 2 25 2] for this slot 'MinPeakHeight' should be 10
Answer: [a{i} , b{i}] = [{17 21 15 25},{2 5 7 9}]
I write above code but for B(j) it only considering 1st value and save it in [a{i}, b{i}].Sneha Parabhttps://uk.mathworks.com/matlabcentral/profile/authors/11415830-sneha-parabtag:uk.mathworks.com,2005:Question/5150672020-04-03T10:32:10Z2020-04-03T10:32:10ZHow to update a regression model on new data without retraining it in full?I built a medium tree model in the Regression Learner App and exported it to the Workspace.
Is it possible to update the model with new data without training the whole data again?Christophhttps://uk.mathworks.com/matlabcentral/profile/authors/10231903-christophtag:uk.mathworks.com,2005:Question/5150652020-04-03T10:17:58Z2020-04-03T10:31:50ZBorder-less tight subplot: figure size and save hey!
I am using the amazing Border-less tight subplot (auto-refresh) by Eduard Reitmann.
I am trying to resize the figure and save it as a .png. Sadly, the command 'set(gcf,'position',[10,10,300,100])' is misbehaving (First opens figure in full screen, than makes it way to small, than moves the figure OFF screen).
Does somebody has experience with this issue? Any other recommendations to do border-ess subplots? I am afraid to go through the list and running into the same isse again.
Executable example code below.
Thanks everybody!!
%create data
TWNovle = rand([1 672])
TWRoldal = rand([1 672])
TWSuldal = rand([1 672])
SWNovle = rand([1 672])
SWRoldal = rand([1 672])
SWSuldal = rand([1 672])
PWNovle = rand([1 672])
PWRoldal = rand([1 672])
PWSuldal = rand([1 672])
xNames = ["C1", "C2", "C3", "C4"];
xTimes = [0:4]
color1 = [.7 .7 .7]
color2 = 'r'
color3 = 'black'
figure('name','subplot_er','Visible','off');
subplot_er(1,3,1);
plot(TWNovle, 'Color',color1); hold on; plot(TWSuldal, 'Color', color2);plot(TWRoldal, 'Color',color3);
xticks([xTimes * 168]); xticklabels(xNames);title('TW'); hold off;
subplot_er(1,3,2);
plot(PWNovle,'Color', color1); hold on; plot(PWSuldal, 'Color',color2);plot(PWRoldal, 'Color',color3);
xticks([xTimes* 168]); xticklabels(xNames);title('PW'); hold off;
subplot_er(1,3,3);
plot(SWNovle, 'Color',color1); hold on; plot(SWSuldal, 'Color',color2);plot(SWRoldal, 'Color',color3);
xticks([xTimes* 168]); xticklabels(xNames);title('SW'); hold off;
%set(gcf,'position',[10,10,300,100])
set(gcf,'Visible','on')
%save
outputFileName = sprintf('ZZ_result_%s.png', datestr(now,'mmddyy_HHMMSS'));
saveas(gcf,outputFileName)
Jon Jaehttps://uk.mathworks.com/matlabcentral/profile/authors/17530830-jon-jaetag:uk.mathworks.com,2005:Question/5150622020-04-03T10:11:25Z2020-04-03T10:27:17ZNeed Help Indexing. I have a 1x12 cell array with each cell containing a 120x2 double. I need to use a for loop to index all the values in every of row in the second column of the 120x2 double and store them in their own 1x12 matrix. Cool = Matrix(:,2);
[row,col] = size(Cool);
N = 1;
M = 1;
for N = 1:1:col
for M = 1:1:row
Cool_Temp{M} = Cool{M}(:,2);
end
endLogan Easterlinhttps://uk.mathworks.com/matlabcentral/profile/authors/17255727-logan-easterlintag:uk.mathworks.com,2005:Question/5143452020-03-31T16:11:35Z2020-04-03T10:22:44ZExplain the average of 8 nearest neighbors Hi, for dead pixel replacement I came across this code from MATLAB file exchange,https://in.mathworks.com/matlabcentral/fileexchange/4551-inpaint_nans . It takes average of 8 nearest neighbors.
% % generate sparse array to average 8 nearest neighbors
% % for each nan element, be careful around edges
fda=spalloc(n*m,n*m,size(nan_list,1)*9);
% -1,-1
L = find((nan_list(:,2) > 1) & (nan_list(:,3) > 1));
nl=length(L);
if nl>0
fda=fda+sparse(repmat(nan_list(L,1),1,2), ...
repmat(nan_list(L,1),1,2)+repmat([-n-1, 0],nl,1), ...
repmat([1 -1],nl,1),n*m,n*m);
end
% eliminate knowns
rhs=-fda(:,known_list)*A(known_list);
% and solve...
B=A;
k=nan_list(:,1);
B(k)=fda(k,k)\rhs(k);
Can you please explain what is [-1, -1]and how the neighbor and its average is calculated in the above code.A Rhttps://uk.mathworks.com/matlabcentral/profile/authors/12431130-a-rtag:uk.mathworks.com,2005:Question/5150332020-04-03T06:38:57Z2020-04-03T10:22:40ZTo store plotregression value in a variabe
is it possible to store the regression (R) value in a variable
%%plots the linear regression of targets relative to outputs.
plotregression(targets,outputs) veeresh ghttps://uk.mathworks.com/matlabcentral/profile/authors/13238562-veeresh-g