Tag Archives: matlab
How do I pass username and password for a named user license with no GUI on linux
I have Matlab R2024A installed on a linux computer with no GUI (terminal only) I want to run matlab -licmode onlinelicensing but also pass my username and password in one line so I don’t have to input it in. Is that possible ?I have Matlab R2024A installed on a linux computer with no GUI (terminal only) I want to run matlab -licmode onlinelicensing but also pass my username and password in one line so I don’t have to input it in. Is that possible ? I have Matlab R2024A installed on a linux computer with no GUI (terminal only) I want to run matlab -licmode onlinelicensing but also pass my username and password in one line so I don’t have to input it in. Is that possible ? license MATLAB Answers — New Questions
How can I replace the upper off diagonal(super diagonal) and lower off diagonal(sub diagonal) of a matrix?
Given a symmetric tridiagonal matrix T generated by
n=5;
p=1;
q=1.7;
r=1;
T=full(gallery(‘tridiagonal’,n,p,q,r));
T=[1.8 1 0 0 0;1 1.8 0 0 0;0 1 1.8 1 0;0 0 1 1.8 1;0 0 0 1 1.8]
How do I change the 1 1 1 1 on both upper and lower off diagonal to 1 0 1 0? What if n is arbitrary, is there any code that fix the off diagonals to a desired vector?Given a symmetric tridiagonal matrix T generated by
n=5;
p=1;
q=1.7;
r=1;
T=full(gallery(‘tridiagonal’,n,p,q,r));
T=[1.8 1 0 0 0;1 1.8 0 0 0;0 1 1.8 1 0;0 0 1 1.8 1;0 0 0 1 1.8]
How do I change the 1 1 1 1 on both upper and lower off diagonal to 1 0 1 0? What if n is arbitrary, is there any code that fix the off diagonals to a desired vector? Given a symmetric tridiagonal matrix T generated by
n=5;
p=1;
q=1.7;
r=1;
T=full(gallery(‘tridiagonal’,n,p,q,r));
T=[1.8 1 0 0 0;1 1.8 0 0 0;0 1 1.8 1 0;0 0 1 1.8 1;0 0 0 1 1.8]
How do I change the 1 1 1 1 on both upper and lower off diagonal to 1 0 1 0? What if n is arbitrary, is there any code that fix the off diagonals to a desired vector? symmetric, tridiagonal, off diagonal MATLAB Answers — New Questions
Can I use the MATLAB Package Manager on Windows without admin permissions?
Can I use the MATLAB Package Manager (MPM) on Windows without administrative privileges?Can I use the MATLAB Package Manager (MPM) on Windows without administrative privileges? Can I use the MATLAB Package Manager (MPM) on Windows without administrative privileges? MATLAB Answers — New Questions
Generating a Sin wave that changes frequency pseudo randomly after each period?
Im trying to program a sig gen that uses mathlad and was wondering if there is a way to generate a sin wave that changes frequency psuedo randomly after each period for a given lenght time? Is there a shortcut or does matlab have a library to accomplish this task?Im trying to program a sig gen that uses mathlad and was wondering if there is a way to generate a sin wave that changes frequency psuedo randomly after each period for a given lenght time? Is there a shortcut or does matlab have a library to accomplish this task? Im trying to program a sig gen that uses mathlad and was wondering if there is a way to generate a sin wave that changes frequency psuedo randomly after each period for a given lenght time? Is there a shortcut or does matlab have a library to accomplish this task? digital signal processing, signal processing, signal MATLAB Answers — New Questions
Error using webwrite: “Recv failure: Connection was reset”
I am using webwrite and get the following error:
"Error connecting to [targeturl]: Recv failure: Connection was reset"
This is the matlab code:
options = weboptions(‘MediaType’,’application/x-www-form-urlencoded’,’Timeout’,Inf);
response = webwrite(url,data,options);
When I execute my equivalent url/data call from Chrome, it works just fine.
It’s knowingly a semi-long wait time for the response. (I’m requesting my target server to build a large CSV dataset then respond with the URL for the CSV). ‘response’ is simply a text string of the CSV url. (Separate code to fetch the CSV works just fine)
The url/data call used to work fine with a Timeout of 900s, then I increased my request to ask for a dataset about 10%-15% larger. Now I keep getting the above error, even though the Timeout upper limit should actually be a little over 2000s. I’ve also tried manual Timeout thesholds at 1000, 1200, 1800, etc to no avail.
It seems like even thought the Timeout is 2000+… something is still timing out…I am using webwrite and get the following error:
"Error connecting to [targeturl]: Recv failure: Connection was reset"
This is the matlab code:
options = weboptions(‘MediaType’,’application/x-www-form-urlencoded’,’Timeout’,Inf);
response = webwrite(url,data,options);
When I execute my equivalent url/data call from Chrome, it works just fine.
It’s knowingly a semi-long wait time for the response. (I’m requesting my target server to build a large CSV dataset then respond with the URL for the CSV). ‘response’ is simply a text string of the CSV url. (Separate code to fetch the CSV works just fine)
The url/data call used to work fine with a Timeout of 900s, then I increased my request to ask for a dataset about 10%-15% larger. Now I keep getting the above error, even though the Timeout upper limit should actually be a little over 2000s. I’ve also tried manual Timeout thesholds at 1000, 1200, 1800, etc to no avail.
It seems like even thought the Timeout is 2000+… something is still timing out… I am using webwrite and get the following error:
"Error connecting to [targeturl]: Recv failure: Connection was reset"
This is the matlab code:
options = weboptions(‘MediaType’,’application/x-www-form-urlencoded’,’Timeout’,Inf);
response = webwrite(url,data,options);
When I execute my equivalent url/data call from Chrome, it works just fine.
It’s knowingly a semi-long wait time for the response. (I’m requesting my target server to build a large CSV dataset then respond with the URL for the CSV). ‘response’ is simply a text string of the CSV url. (Separate code to fetch the CSV works just fine)
The url/data call used to work fine with a Timeout of 900s, then I increased my request to ask for a dataset about 10%-15% larger. Now I keep getting the above error, even though the Timeout upper limit should actually be a little over 2000s. I’ve also tried manual Timeout thesholds at 1000, 1200, 1800, etc to no avail.
It seems like even thought the Timeout is 2000+… something is still timing out… webwrite, timeout MATLAB Answers — New Questions
How to fit a nonparametric distribution to a sample of known percentile values
Hello everyone
I have a sample of percentile values that describe the distribution of possible earthquake acceleration levels that lead to the failure of a building component. I would like to fit a nonparametric model to these data. I know that, for a random sample of these earthquake acceleration levels, I coiuld fit a nonparametric density using the the ksdensity function but is there a way to do a similar fit for the cumulative distribution function of this function?
Many thanks
Example data:
percentiles = [3 11 27 33 52 66 75 87 92];
acc = [0.3339 0.3595 0.4209 0.4283 0.4645 0.5010 0.5080 0.5713 0.6025];Hello everyone
I have a sample of percentile values that describe the distribution of possible earthquake acceleration levels that lead to the failure of a building component. I would like to fit a nonparametric model to these data. I know that, for a random sample of these earthquake acceleration levels, I coiuld fit a nonparametric density using the the ksdensity function but is there a way to do a similar fit for the cumulative distribution function of this function?
Many thanks
Example data:
percentiles = [3 11 27 33 52 66 75 87 92];
acc = [0.3339 0.3595 0.4209 0.4283 0.4645 0.5010 0.5080 0.5713 0.6025]; Hello everyone
I have a sample of percentile values that describe the distribution of possible earthquake acceleration levels that lead to the failure of a building component. I would like to fit a nonparametric model to these data. I know that, for a random sample of these earthquake acceleration levels, I coiuld fit a nonparametric density using the the ksdensity function but is there a way to do a similar fit for the cumulative distribution function of this function?
Many thanks
Example data:
percentiles = [3 11 27 33 52 66 75 87 92];
acc = [0.3339 0.3595 0.4209 0.4283 0.4645 0.5010 0.5080 0.5713 0.6025]; nonparametric distribution fitting, percentile data MATLAB Answers — New Questions
Nozzle Design Error: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.
Greetings everyone, I am trying to look into a code found here corydodson/NozzleDesign: Design of supersonic nozzles (github.com). However, I run into an error whenever I run the code which reads "Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN. " I belive the error comes from this internalnode.m function. x,y are the coordinates, t0 is the temperature and d can be 0 or 1 depending on the user. Anyway I can resolve this? Any help is appreciated!
function [xOut,yOut,uOut,vOut] = internalnode(t0,species,moleFracs,x,y,u,v,d)
h0 = mixprop(‘h’,species,moleFracs,t0);
r = mixprop(‘r’,species,moleFracs)*1000;
L = length(x);
minus = logical([ones(L – 1,1);0]);
plus = logical([0;ones(L – 1,1)]);
xm = x(minus);
xmCalc = xm;
xp = x(plus);
ym = y(minus);
ymCalc = ym;
yp = y(plus);
ypCalc = yp;
um = u(minus);
umCalc = um;
up = u(plus);
upCalc = up;
vm = v(minus);
vmCalc = vm;
vp = v(plus);
vpCalc = vp;
sp = vm;
N = 20;
err = 1e-4;
notConv = true(1,4);
for i = 1:N
ymCalc = (ym + ymCalc)/2;
ypCalc = (yp + ypCalc)/2;
umCalc = (um + umCalc)/2;
upCalc = (up + upCalc)/2;
vmCalc = (vm + vmCalc)/2;
vpCalc = (vp + vpCalc)/2;
uCalc = [umCalc;upCalc(end)];
vCalc = [vmCalc;vpCalc(end)];
vMag = sqrt(uCalc.^2 + vCalc.^2);
h = h0 – vMag.^2/2000;
t = tempfromprop(species,moleFracs,’h’,h);
g = mixprop(‘gamma’,species,moleFracs,t);
a = sqrt(r*g.*t);
am = a(minus);
ap = a(plus);
mu = asind(a./vMag);
mum = mu(minus);
mup = mu(plus);
theta = atand(vCalc./uCalc);
thetam = theta(minus);
thetap = theta(plus);
lm = tand(thetam – mum);
lp = tand(thetap + mup);
q = uCalc.^2 – a.^2;
qm = q(minus);
qp = q(plus);
rm = 2*umCalc.*vmCalc – qm.*lm;
rp = 2*upCalc.*vpCalc – qp.*lp;
sm = d*am.^2.*vmCalc./ymCalc;
switch isempty(sp(ypCalc == 0))
case 1
sp = d*ap.^2.*vpCalc./ypCalc;
otherwise
sp(ypCalc ~= 0) = d*ap(ypCalc ~= 0).^2.*vpCalc(ypCalc ~= 0)./ypCalc(ypCalc ~= 0);
sp(ypCalc == 0) = sm(end);
end
A = zeros(L);
B = zeros(L,1);
for j = 1:L – 1
A(2*(j – 1) + 1:2*j,2*(j – 1) + 1:2*j) = [1,-lp(j);…
1,-lm(j)];
B(2*(j – 1) + 1:2*j) = [yp(j) – lp(j)*xp(j);…
ym(j) – lm(j)*xm(j)];
end
X = AB;
ymCalc = X(1:2:end);
ypCalc = ymCalc;
xmCalc = X(2:2:end);
xpCalc = xmCalc;
for j = 1:L – 1
A(2*(j – 1) + 1:2*j,2*(j – 1) + 1:2*j) = [qp(j),rp(j);…
qm(j),rm(j)];
B(2*(j – 1) + 1:2*j) = [sp(j)*(xpCalc(j) – xp(j)) + qp(j)*up(j) + rp(j)*vp(j);…
sm(j)*(xmCalc(j) – xm(j)) + qm(j)*um(j) + rm(j)*vm(j)];
end
X = AB;
umCalc = X(1:2:end);
upCalc = umCalc;
vmCalc = X(2:2:end);
vpCalc = vmCalc;
switch i ~= 1
case 1
notConv = abs([xmCalc,ymCalc,umCalc,vmCalc]./check0 – 1) > err;
end
check0 = [xmCalc,ymCalc,umCalc,vmCalc];
switch sum(sum(notConv)) == 0
case 1
break
end
switch isnan(xmCalc) | isnan(ymCalc) | isnan(umCalc) | isnan(vmCalc)
case 1
break
end
end
xOut = xmCalc;
yOut = ymCalc;
uOut = umCalc;
vOut = vmCalc;
endGreetings everyone, I am trying to look into a code found here corydodson/NozzleDesign: Design of supersonic nozzles (github.com). However, I run into an error whenever I run the code which reads "Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN. " I belive the error comes from this internalnode.m function. x,y are the coordinates, t0 is the temperature and d can be 0 or 1 depending on the user. Anyway I can resolve this? Any help is appreciated!
function [xOut,yOut,uOut,vOut] = internalnode(t0,species,moleFracs,x,y,u,v,d)
h0 = mixprop(‘h’,species,moleFracs,t0);
r = mixprop(‘r’,species,moleFracs)*1000;
L = length(x);
minus = logical([ones(L – 1,1);0]);
plus = logical([0;ones(L – 1,1)]);
xm = x(minus);
xmCalc = xm;
xp = x(plus);
ym = y(minus);
ymCalc = ym;
yp = y(plus);
ypCalc = yp;
um = u(minus);
umCalc = um;
up = u(plus);
upCalc = up;
vm = v(minus);
vmCalc = vm;
vp = v(plus);
vpCalc = vp;
sp = vm;
N = 20;
err = 1e-4;
notConv = true(1,4);
for i = 1:N
ymCalc = (ym + ymCalc)/2;
ypCalc = (yp + ypCalc)/2;
umCalc = (um + umCalc)/2;
upCalc = (up + upCalc)/2;
vmCalc = (vm + vmCalc)/2;
vpCalc = (vp + vpCalc)/2;
uCalc = [umCalc;upCalc(end)];
vCalc = [vmCalc;vpCalc(end)];
vMag = sqrt(uCalc.^2 + vCalc.^2);
h = h0 – vMag.^2/2000;
t = tempfromprop(species,moleFracs,’h’,h);
g = mixprop(‘gamma’,species,moleFracs,t);
a = sqrt(r*g.*t);
am = a(minus);
ap = a(plus);
mu = asind(a./vMag);
mum = mu(minus);
mup = mu(plus);
theta = atand(vCalc./uCalc);
thetam = theta(minus);
thetap = theta(plus);
lm = tand(thetam – mum);
lp = tand(thetap + mup);
q = uCalc.^2 – a.^2;
qm = q(minus);
qp = q(plus);
rm = 2*umCalc.*vmCalc – qm.*lm;
rp = 2*upCalc.*vpCalc – qp.*lp;
sm = d*am.^2.*vmCalc./ymCalc;
switch isempty(sp(ypCalc == 0))
case 1
sp = d*ap.^2.*vpCalc./ypCalc;
otherwise
sp(ypCalc ~= 0) = d*ap(ypCalc ~= 0).^2.*vpCalc(ypCalc ~= 0)./ypCalc(ypCalc ~= 0);
sp(ypCalc == 0) = sm(end);
end
A = zeros(L);
B = zeros(L,1);
for j = 1:L – 1
A(2*(j – 1) + 1:2*j,2*(j – 1) + 1:2*j) = [1,-lp(j);…
1,-lm(j)];
B(2*(j – 1) + 1:2*j) = [yp(j) – lp(j)*xp(j);…
ym(j) – lm(j)*xm(j)];
end
X = AB;
ymCalc = X(1:2:end);
ypCalc = ymCalc;
xmCalc = X(2:2:end);
xpCalc = xmCalc;
for j = 1:L – 1
A(2*(j – 1) + 1:2*j,2*(j – 1) + 1:2*j) = [qp(j),rp(j);…
qm(j),rm(j)];
B(2*(j – 1) + 1:2*j) = [sp(j)*(xpCalc(j) – xp(j)) + qp(j)*up(j) + rp(j)*vp(j);…
sm(j)*(xmCalc(j) – xm(j)) + qm(j)*um(j) + rm(j)*vm(j)];
end
X = AB;
umCalc = X(1:2:end);
upCalc = umCalc;
vmCalc = X(2:2:end);
vpCalc = vmCalc;
switch i ~= 1
case 1
notConv = abs([xmCalc,ymCalc,umCalc,vmCalc]./check0 – 1) > err;
end
check0 = [xmCalc,ymCalc,umCalc,vmCalc];
switch sum(sum(notConv)) == 0
case 1
break
end
switch isnan(xmCalc) | isnan(ymCalc) | isnan(umCalc) | isnan(vmCalc)
case 1
break
end
end
xOut = xmCalc;
yOut = ymCalc;
uOut = umCalc;
vOut = vmCalc;
end Greetings everyone, I am trying to look into a code found here corydodson/NozzleDesign: Design of supersonic nozzles (github.com). However, I run into an error whenever I run the code which reads "Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN. " I belive the error comes from this internalnode.m function. x,y are the coordinates, t0 is the temperature and d can be 0 or 1 depending on the user. Anyway I can resolve this? Any help is appreciated!
function [xOut,yOut,uOut,vOut] = internalnode(t0,species,moleFracs,x,y,u,v,d)
h0 = mixprop(‘h’,species,moleFracs,t0);
r = mixprop(‘r’,species,moleFracs)*1000;
L = length(x);
minus = logical([ones(L – 1,1);0]);
plus = logical([0;ones(L – 1,1)]);
xm = x(minus);
xmCalc = xm;
xp = x(plus);
ym = y(minus);
ymCalc = ym;
yp = y(plus);
ypCalc = yp;
um = u(minus);
umCalc = um;
up = u(plus);
upCalc = up;
vm = v(minus);
vmCalc = vm;
vp = v(plus);
vpCalc = vp;
sp = vm;
N = 20;
err = 1e-4;
notConv = true(1,4);
for i = 1:N
ymCalc = (ym + ymCalc)/2;
ypCalc = (yp + ypCalc)/2;
umCalc = (um + umCalc)/2;
upCalc = (up + upCalc)/2;
vmCalc = (vm + vmCalc)/2;
vpCalc = (vp + vpCalc)/2;
uCalc = [umCalc;upCalc(end)];
vCalc = [vmCalc;vpCalc(end)];
vMag = sqrt(uCalc.^2 + vCalc.^2);
h = h0 – vMag.^2/2000;
t = tempfromprop(species,moleFracs,’h’,h);
g = mixprop(‘gamma’,species,moleFracs,t);
a = sqrt(r*g.*t);
am = a(minus);
ap = a(plus);
mu = asind(a./vMag);
mum = mu(minus);
mup = mu(plus);
theta = atand(vCalc./uCalc);
thetam = theta(minus);
thetap = theta(plus);
lm = tand(thetam – mum);
lp = tand(thetap + mup);
q = uCalc.^2 – a.^2;
qm = q(minus);
qp = q(plus);
rm = 2*umCalc.*vmCalc – qm.*lm;
rp = 2*upCalc.*vpCalc – qp.*lp;
sm = d*am.^2.*vmCalc./ymCalc;
switch isempty(sp(ypCalc == 0))
case 1
sp = d*ap.^2.*vpCalc./ypCalc;
otherwise
sp(ypCalc ~= 0) = d*ap(ypCalc ~= 0).^2.*vpCalc(ypCalc ~= 0)./ypCalc(ypCalc ~= 0);
sp(ypCalc == 0) = sm(end);
end
A = zeros(L);
B = zeros(L,1);
for j = 1:L – 1
A(2*(j – 1) + 1:2*j,2*(j – 1) + 1:2*j) = [1,-lp(j);…
1,-lm(j)];
B(2*(j – 1) + 1:2*j) = [yp(j) – lp(j)*xp(j);…
ym(j) – lm(j)*xm(j)];
end
X = AB;
ymCalc = X(1:2:end);
ypCalc = ymCalc;
xmCalc = X(2:2:end);
xpCalc = xmCalc;
for j = 1:L – 1
A(2*(j – 1) + 1:2*j,2*(j – 1) + 1:2*j) = [qp(j),rp(j);…
qm(j),rm(j)];
B(2*(j – 1) + 1:2*j) = [sp(j)*(xpCalc(j) – xp(j)) + qp(j)*up(j) + rp(j)*vp(j);…
sm(j)*(xmCalc(j) – xm(j)) + qm(j)*um(j) + rm(j)*vm(j)];
end
X = AB;
umCalc = X(1:2:end);
upCalc = umCalc;
vmCalc = X(2:2:end);
vpCalc = vmCalc;
switch i ~= 1
case 1
notConv = abs([xmCalc,ymCalc,umCalc,vmCalc]./check0 – 1) > err;
end
check0 = [xmCalc,ymCalc,umCalc,vmCalc];
switch sum(sum(notConv)) == 0
case 1
break
end
switch isnan(xmCalc) | isnan(ymCalc) | isnan(umCalc) | isnan(vmCalc)
case 1
break
end
end
xOut = xmCalc;
yOut = ymCalc;
uOut = umCalc;
vOut = vmCalc;
end #matlab, #nozzle, #method of characteristics, #singular MATLAB Answers — New Questions
Does variation point blocks get generated for OPERATION-INVOKED-EVENT runnables ?
I have added Variation points for a runnable like below from systemdesk
<RUNNABLE-ENTITY UUID="32a97bd4-8cc3-443b-979d-8423bf9af7c1">
<SHORT-NAME>ActvAirDamCtrlDTIStart</SHORT-NAME>
<MINIMUM-START-INTERVAL>0</MINIMUM-START-INTERVAL>
<CAN-BE-INVOKED-CONCURRENTLY>true</CAN-BE-INVOKED-CONCURRENTLY>
<SYMBOL>ActvAirDamCtrl_ActvAirDamCtrlDTIStart</SYMBOL>
<VARIATION-POINT>
<SHORT-LABEL>ActvAirDamVPnt</SHORT-LABEL>
<SW-SYSCOND BINDING-TIME="PRE-COMPILE-TIME">
<SYSC-STRING-REF DEST="SW-SYSTEMCONST">/FCAVariants/VariantManagement/BuildActvAirDam</SYSC-STRING-REF>==1</SW-SYSCOND>
</VARIATION-POINT>
</RUNNABLE-ENTITY>
But once the model is created the runnable does not contain this variation pointI have added Variation points for a runnable like below from systemdesk
<RUNNABLE-ENTITY UUID="32a97bd4-8cc3-443b-979d-8423bf9af7c1">
<SHORT-NAME>ActvAirDamCtrlDTIStart</SHORT-NAME>
<MINIMUM-START-INTERVAL>0</MINIMUM-START-INTERVAL>
<CAN-BE-INVOKED-CONCURRENTLY>true</CAN-BE-INVOKED-CONCURRENTLY>
<SYMBOL>ActvAirDamCtrl_ActvAirDamCtrlDTIStart</SYMBOL>
<VARIATION-POINT>
<SHORT-LABEL>ActvAirDamVPnt</SHORT-LABEL>
<SW-SYSCOND BINDING-TIME="PRE-COMPILE-TIME">
<SYSC-STRING-REF DEST="SW-SYSTEMCONST">/FCAVariants/VariantManagement/BuildActvAirDam</SYSC-STRING-REF>==1</SW-SYSCOND>
</VARIATION-POINT>
</RUNNABLE-ENTITY>
But once the model is created the runnable does not contain this variation point I have added Variation points for a runnable like below from systemdesk
<RUNNABLE-ENTITY UUID="32a97bd4-8cc3-443b-979d-8423bf9af7c1">
<SHORT-NAME>ActvAirDamCtrlDTIStart</SHORT-NAME>
<MINIMUM-START-INTERVAL>0</MINIMUM-START-INTERVAL>
<CAN-BE-INVOKED-CONCURRENTLY>true</CAN-BE-INVOKED-CONCURRENTLY>
<SYMBOL>ActvAirDamCtrl_ActvAirDamCtrlDTIStart</SYMBOL>
<VARIATION-POINT>
<SHORT-LABEL>ActvAirDamVPnt</SHORT-LABEL>
<SW-SYSCOND BINDING-TIME="PRE-COMPILE-TIME">
<SYSC-STRING-REF DEST="SW-SYSTEMCONST">/FCAVariants/VariantManagement/BuildActvAirDam</SYSC-STRING-REF>==1</SW-SYSCOND>
</VARIATION-POINT>
</RUNNABLE-ENTITY>
But once the model is created the runnable does not contain this variation point model, simulink, matlab MATLAB Answers — New Questions
How do I assign an index value to a function output?
Using R2014b. I have a function called within a for loop which returns lots of outputs. I want to assign an index value for each output of the function as the loop runs. Something like:
for ind = 1:n
[output1(ind),output2(ind), …] = function(inputs)
end
This doesn’t appear to work (results in an error). Is there an easy way to code this without doing:
output1(ind) = output1;
output2(ind) = output2;
for each variable after the function call?Using R2014b. I have a function called within a for loop which returns lots of outputs. I want to assign an index value for each output of the function as the loop runs. Something like:
for ind = 1:n
[output1(ind),output2(ind), …] = function(inputs)
end
This doesn’t appear to work (results in an error). Is there an easy way to code this without doing:
output1(ind) = output1;
output2(ind) = output2;
for each variable after the function call? Using R2014b. I have a function called within a for loop which returns lots of outputs. I want to assign an index value for each output of the function as the loop runs. Something like:
for ind = 1:n
[output1(ind),output2(ind), …] = function(inputs)
end
This doesn’t appear to work (results in an error). Is there an easy way to code this without doing:
output1(ind) = output1;
output2(ind) = output2;
for each variable after the function call? function output indexing MATLAB Answers — New Questions
Help Needed: Fixing Indexing Error in MATLAB Random Name Generator Code
I am working on developing a name generator tool in MATLAB to produce random names for individuals or animals. I am inspired by the functionality of the website nameswhisperer.com and aim to create a similar tool.
I have written the following MATLAB code to generate random names:
function randomName = generateRandomName()
% Define lists of name components
firstNames = {‘Alex’, ‘Jordan’, ‘Taylor’, ‘Riley’, ‘Morgan’};
lastNames = {‘Smith’, ‘Johnson’, ‘Williams’, ‘Brown’, ‘Jones’};
% Generate random indices
firstNameIndex = randi(length(firstNames));
lastNameIndex = randi(length(lastNames));
% Construct random name
randomName = [firstNames(firstNameIndex) ‘ ‘ lastNames(lastNameIndex)];
end
% Example usage
name = generateRandomName();
disp([‘Generated Name: ‘ name]);
However, I am encountering an issue with the code. Specifically, when I run the script, I receive an error related to the way names are indexed and concatenated.
Could you help identify and correct the mistake in the code?
Thank you for your assistance!I am working on developing a name generator tool in MATLAB to produce random names for individuals or animals. I am inspired by the functionality of the website nameswhisperer.com and aim to create a similar tool.
I have written the following MATLAB code to generate random names:
function randomName = generateRandomName()
% Define lists of name components
firstNames = {‘Alex’, ‘Jordan’, ‘Taylor’, ‘Riley’, ‘Morgan’};
lastNames = {‘Smith’, ‘Johnson’, ‘Williams’, ‘Brown’, ‘Jones’};
% Generate random indices
firstNameIndex = randi(length(firstNames));
lastNameIndex = randi(length(lastNames));
% Construct random name
randomName = [firstNames(firstNameIndex) ‘ ‘ lastNames(lastNameIndex)];
end
% Example usage
name = generateRandomName();
disp([‘Generated Name: ‘ name]);
However, I am encountering an issue with the code. Specifically, when I run the script, I receive an error related to the way names are indexed and concatenated.
Could you help identify and correct the mistake in the code?
Thank you for your assistance! I am working on developing a name generator tool in MATLAB to produce random names for individuals or animals. I am inspired by the functionality of the website nameswhisperer.com and aim to create a similar tool.
I have written the following MATLAB code to generate random names:
function randomName = generateRandomName()
% Define lists of name components
firstNames = {‘Alex’, ‘Jordan’, ‘Taylor’, ‘Riley’, ‘Morgan’};
lastNames = {‘Smith’, ‘Johnson’, ‘Williams’, ‘Brown’, ‘Jones’};
% Generate random indices
firstNameIndex = randi(length(firstNames));
lastNameIndex = randi(length(lastNames));
% Construct random name
randomName = [firstNames(firstNameIndex) ‘ ‘ lastNames(lastNameIndex)];
end
% Example usage
name = generateRandomName();
disp([‘Generated Name: ‘ name]);
However, I am encountering an issue with the code. Specifically, when I run the script, I receive an error related to the way names are indexed and concatenated.
Could you help identify and correct the mistake in the code?
Thank you for your assistance! matlab, matlab code MATLAB Answers — New Questions
Using Metal cylinder rod replace rectangle shape Yagi-uda antenna design
Hi I want to ask is there any ways to change the geometry shape of antenna toolbox designing yagi antenna. The default shape is in rectangle shape, and I want it to be in cylindrical form as I want to create it physically. Is there any ways to change the shape?Hi I want to ask is there any ways to change the geometry shape of antenna toolbox designing yagi antenna. The default shape is in rectangle shape, and I want it to be in cylindrical form as I want to create it physically. Is there any ways to change the shape? Hi I want to ask is there any ways to change the geometry shape of antenna toolbox designing yagi antenna. The default shape is in rectangle shape, and I want it to be in cylindrical form as I want to create it physically. Is there any ways to change the shape? antenna, simulation, emf MATLAB Answers — New Questions
undefined function or variable: docopt
Undefined function or variable ‘docopt’.
Error in install_SplitLab (line 384)
[doccmd,options,docpath] = docoptUndefined function or variable ‘docopt’.
Error in install_SplitLab (line 384)
[doccmd,options,docpath] = docopt Undefined function or variable ‘docopt’.
Error in install_SplitLab (line 384)
[doccmd,options,docpath] = docopt splitlab1.2.1 MATLAB Answers — New Questions
Methods of Detecting and Removing Protrusions in Image
Is there any way to remove only the red shaded area of an image like the one below?
The data is a binary image and is binarized.
The image we are recognizing is basically a figure like the one on the left, so we can use bwareafilt to extract the maximum structure.
However, sometimes we get images like the one on the right. It does not mean that every time they are attached.
It would be best if we could set a threshold (if they are too close together, we recognize them as one), since the degree of attachment of the two objects varies.
We would appreciate it if you could let us know.Is there any way to remove only the red shaded area of an image like the one below?
The data is a binary image and is binarized.
The image we are recognizing is basically a figure like the one on the left, so we can use bwareafilt to extract the maximum structure.
However, sometimes we get images like the one on the right. It does not mean that every time they are attached.
It would be best if we could set a threshold (if they are too close together, we recognize them as one), since the degree of attachment of the two objects varies.
We would appreciate it if you could let us know. Is there any way to remove only the red shaded area of an image like the one below?
The data is a binary image and is binarized.
The image we are recognizing is basically a figure like the one on the left, so we can use bwareafilt to extract the maximum structure.
However, sometimes we get images like the one on the right. It does not mean that every time they are attached.
It would be best if we could set a threshold (if they are too close together, we recognize them as one), since the degree of attachment of the two objects varies.
We would appreciate it if you could let us know. image analysis, image segmentation MATLAB Answers — New Questions
How to create dynamic options in system object block mask parameters
I want to make the dropdown content of one system object parameter based on the value of another parameter. In other words, Timer 1 may support options A, B and C, while Timer 2 would only support options A and B. I can do this in a standard subsystem block mask by modifying the option parameter dropdown content on the callback for the timer parameter. MATLAB system objects only seem to support defining dropdown content for their parameters statically. Is this possible?I want to make the dropdown content of one system object parameter based on the value of another parameter. In other words, Timer 1 may support options A, B and C, while Timer 2 would only support options A and B. I can do this in a standard subsystem block mask by modifying the option parameter dropdown content on the callback for the timer parameter. MATLAB system objects only seem to support defining dropdown content for their parameters statically. Is this possible? I want to make the dropdown content of one system object parameter based on the value of another parameter. In other words, Timer 1 may support options A, B and C, while Timer 2 would only support options A and B. I can do this in a standard subsystem block mask by modifying the option parameter dropdown content on the callback for the timer parameter. MATLAB system objects only seem to support defining dropdown content for their parameters statically. Is this possible? matlab system objects MATLAB Answers — New Questions
Impact of Gripper’s Roll Angle on Reachable Poses for UR5e Robot
When I change the roll angle of the gripper, as demonstrated in my example code, the number of reachable poses varies for each roll angle. I’ve tested this with the same number of reference bodies (bodyName). The results were 411, 540, 513, and 547 reachable poses for different roll angles. I understand that this variation arises because each roll angle results in a different final configuration for the robot, affecting the GIK (Generalized Inverse Kinematics) solution. However, for a UR5e robot, this variation should not occur in real, right ? In practical use, can the UR5e achieve all 547 (assuming it’s the maximum it’s capable of reaching in this case) reachable poses for each roll angle?
for orientationIdx = 1:size(orientationsToTest,1)
for rollIdx = 1:numRollAngles
orientationsToTest(:,3) = rollAngles(rollIdx);
currentOrientation = orientationsToTest(orientationIdx,:);
targetPose = constraintPoseTarget(gripper);
targetPose.ReferenceBody = bodyName; %reference body
targetPose.TargetTransform = trvec2tform([0 0 0]) * eul2tform(currentOrientation,"XYZ");
[qWaypoints(2,:),solutionInfo] = gik_Pick(q0,targetPose);
end
endWhen I change the roll angle of the gripper, as demonstrated in my example code, the number of reachable poses varies for each roll angle. I’ve tested this with the same number of reference bodies (bodyName). The results were 411, 540, 513, and 547 reachable poses for different roll angles. I understand that this variation arises because each roll angle results in a different final configuration for the robot, affecting the GIK (Generalized Inverse Kinematics) solution. However, for a UR5e robot, this variation should not occur in real, right ? In practical use, can the UR5e achieve all 547 (assuming it’s the maximum it’s capable of reaching in this case) reachable poses for each roll angle?
for orientationIdx = 1:size(orientationsToTest,1)
for rollIdx = 1:numRollAngles
orientationsToTest(:,3) = rollAngles(rollIdx);
currentOrientation = orientationsToTest(orientationIdx,:);
targetPose = constraintPoseTarget(gripper);
targetPose.ReferenceBody = bodyName; %reference body
targetPose.TargetTransform = trvec2tform([0 0 0]) * eul2tform(currentOrientation,"XYZ");
[qWaypoints(2,:),solutionInfo] = gik_Pick(q0,targetPose);
end
end When I change the roll angle of the gripper, as demonstrated in my example code, the number of reachable poses varies for each roll angle. I’ve tested this with the same number of reference bodies (bodyName). The results were 411, 540, 513, and 547 reachable poses for different roll angles. I understand that this variation arises because each roll angle results in a different final configuration for the robot, affecting the GIK (Generalized Inverse Kinematics) solution. However, for a UR5e robot, this variation should not occur in real, right ? In practical use, can the UR5e achieve all 547 (assuming it’s the maximum it’s capable of reaching in this case) reachable poses for each roll angle?
for orientationIdx = 1:size(orientationsToTest,1)
for rollIdx = 1:numRollAngles
orientationsToTest(:,3) = rollAngles(rollIdx);
currentOrientation = orientationsToTest(orientationIdx,:);
targetPose = constraintPoseTarget(gripper);
targetPose.ReferenceBody = bodyName; %reference body
targetPose.TargetTransform = trvec2tform([0 0 0]) * eul2tform(currentOrientation,"XYZ");
[qWaypoints(2,:),solutionInfo] = gik_Pick(q0,targetPose);
end
end matlab MATLAB Answers — New Questions
Conv2d, fully connected layers, and regression – number of predictions and number of channels mismatch
Hello! I’m trying to get a CNN up and running and I think I’m almost there, but I’m still running into a few errors. What I would like is to have a series of 1D convolutions with a featureInputLayer, but those throw the following error:
Caused by:
Layer ‘conv1d1’: Input data must have one spatial dimension only, one temporal dimension only, or one of each. Instead, it
has 0 spatial dimensions and 0 temporal dimensions.
According to https://www.mathworks.com/matlabcentral/answers/1747170-error-on-convolutional-layer-s-input-data-has-0-spatial-dimensions-and-0-temporal-dimensions the workaround is to reformat the CNN to a conv2d using N x 1 "images." So, I’ve tried that and now I have a new and interesting problem:
Error using trainnet (line 46)
Number of channels in predictions (3) must match the number of channels in the targets (1).
Error in convNet_1_edits (line 97)
[trainedNet, trainInfo]=trainnet(masterTrain,net,’mse’,options);
This problem has been approached several times before (https://www.mathworks.com/matlabcentral/answers/2123216-error-in-deep-learning-classification-code/?s_tid=ans_lp_feed_leaf and others) but none of them that I’ve found have used fully connected layers. For reference, my CNN is the following:
layers = [
imageInputLayer(nFeatures, "name", "input");
convolution2dLayer(f1Size, numFilters1, ‘padding’, ‘same’,…
"name", "conv1")
batchNormalizationLayer();
reluLayer();
convolution2dLayer(f1Size, numFilters2, "padding", "same",…
‘numchannels’, numFilters1, ‘name’, ‘conv2’)
batchNormalizationLayer();
reluLayer();
maxPooling2dLayer([1, 3]);
convolution2dLayer(f1Size, numFilters3, "padding", "same",…
‘numchannels’, numFilters2, ‘name’, ‘conv3’)
batchNormalizationLayer();
reluLayer();
maxPooling2dLayer([1, 5]);
fullyConnectedLayer(60, ‘name’, ‘fc1’)
reluLayer()
fullyConnectedLayer(30, ‘name’, ‘fc2’)
reluLayer()
fullyConnectedLayer(15, ‘name’, ‘fc3’)
reluLayer()
fullyConnectedLayer(3, ‘name’, ‘fc4’)
% regressionLayer()
];
net = dlnetwork;
net = addLayers(net, layers);
And I am using trainnetwork and a datastore. The output of read(ds) produces the following:
read(masterTest)
ans =
1×4 cell array
{1×1341 double} {[0.6500]} {[6.8000e-07]} {[0.0250]}
Where I have a 1 x 1341 set of features being used to predict three outputs. I thought the three neurons in my final fully connected layer would be the regression outputs, but there seems to be a mismatch in the number of predictions and number of targets. How can I align the number of predictions and targets when using regression in FC layers?Hello! I’m trying to get a CNN up and running and I think I’m almost there, but I’m still running into a few errors. What I would like is to have a series of 1D convolutions with a featureInputLayer, but those throw the following error:
Caused by:
Layer ‘conv1d1’: Input data must have one spatial dimension only, one temporal dimension only, or one of each. Instead, it
has 0 spatial dimensions and 0 temporal dimensions.
According to https://www.mathworks.com/matlabcentral/answers/1747170-error-on-convolutional-layer-s-input-data-has-0-spatial-dimensions-and-0-temporal-dimensions the workaround is to reformat the CNN to a conv2d using N x 1 "images." So, I’ve tried that and now I have a new and interesting problem:
Error using trainnet (line 46)
Number of channels in predictions (3) must match the number of channels in the targets (1).
Error in convNet_1_edits (line 97)
[trainedNet, trainInfo]=trainnet(masterTrain,net,’mse’,options);
This problem has been approached several times before (https://www.mathworks.com/matlabcentral/answers/2123216-error-in-deep-learning-classification-code/?s_tid=ans_lp_feed_leaf and others) but none of them that I’ve found have used fully connected layers. For reference, my CNN is the following:
layers = [
imageInputLayer(nFeatures, "name", "input");
convolution2dLayer(f1Size, numFilters1, ‘padding’, ‘same’,…
"name", "conv1")
batchNormalizationLayer();
reluLayer();
convolution2dLayer(f1Size, numFilters2, "padding", "same",…
‘numchannels’, numFilters1, ‘name’, ‘conv2’)
batchNormalizationLayer();
reluLayer();
maxPooling2dLayer([1, 3]);
convolution2dLayer(f1Size, numFilters3, "padding", "same",…
‘numchannels’, numFilters2, ‘name’, ‘conv3’)
batchNormalizationLayer();
reluLayer();
maxPooling2dLayer([1, 5]);
fullyConnectedLayer(60, ‘name’, ‘fc1’)
reluLayer()
fullyConnectedLayer(30, ‘name’, ‘fc2’)
reluLayer()
fullyConnectedLayer(15, ‘name’, ‘fc3’)
reluLayer()
fullyConnectedLayer(3, ‘name’, ‘fc4’)
% regressionLayer()
];
net = dlnetwork;
net = addLayers(net, layers);
And I am using trainnetwork and a datastore. The output of read(ds) produces the following:
read(masterTest)
ans =
1×4 cell array
{1×1341 double} {[0.6500]} {[6.8000e-07]} {[0.0250]}
Where I have a 1 x 1341 set of features being used to predict three outputs. I thought the three neurons in my final fully connected layer would be the regression outputs, but there seems to be a mismatch in the number of predictions and number of targets. How can I align the number of predictions and targets when using regression in FC layers? Hello! I’m trying to get a CNN up and running and I think I’m almost there, but I’m still running into a few errors. What I would like is to have a series of 1D convolutions with a featureInputLayer, but those throw the following error:
Caused by:
Layer ‘conv1d1’: Input data must have one spatial dimension only, one temporal dimension only, or one of each. Instead, it
has 0 spatial dimensions and 0 temporal dimensions.
According to https://www.mathworks.com/matlabcentral/answers/1747170-error-on-convolutional-layer-s-input-data-has-0-spatial-dimensions-and-0-temporal-dimensions the workaround is to reformat the CNN to a conv2d using N x 1 "images." So, I’ve tried that and now I have a new and interesting problem:
Error using trainnet (line 46)
Number of channels in predictions (3) must match the number of channels in the targets (1).
Error in convNet_1_edits (line 97)
[trainedNet, trainInfo]=trainnet(masterTrain,net,’mse’,options);
This problem has been approached several times before (https://www.mathworks.com/matlabcentral/answers/2123216-error-in-deep-learning-classification-code/?s_tid=ans_lp_feed_leaf and others) but none of them that I’ve found have used fully connected layers. For reference, my CNN is the following:
layers = [
imageInputLayer(nFeatures, "name", "input");
convolution2dLayer(f1Size, numFilters1, ‘padding’, ‘same’,…
"name", "conv1")
batchNormalizationLayer();
reluLayer();
convolution2dLayer(f1Size, numFilters2, "padding", "same",…
‘numchannels’, numFilters1, ‘name’, ‘conv2’)
batchNormalizationLayer();
reluLayer();
maxPooling2dLayer([1, 3]);
convolution2dLayer(f1Size, numFilters3, "padding", "same",…
‘numchannels’, numFilters2, ‘name’, ‘conv3’)
batchNormalizationLayer();
reluLayer();
maxPooling2dLayer([1, 5]);
fullyConnectedLayer(60, ‘name’, ‘fc1’)
reluLayer()
fullyConnectedLayer(30, ‘name’, ‘fc2’)
reluLayer()
fullyConnectedLayer(15, ‘name’, ‘fc3’)
reluLayer()
fullyConnectedLayer(3, ‘name’, ‘fc4’)
% regressionLayer()
];
net = dlnetwork;
net = addLayers(net, layers);
And I am using trainnetwork and a datastore. The output of read(ds) produces the following:
read(masterTest)
ans =
1×4 cell array
{1×1341 double} {[0.6500]} {[6.8000e-07]} {[0.0250]}
Where I have a 1 x 1341 set of features being used to predict three outputs. I thought the three neurons in my final fully connected layer would be the regression outputs, but there seems to be a mismatch in the number of predictions and number of targets. How can I align the number of predictions and targets when using regression in FC layers? convolution, cnn, regression, trainnet MATLAB Answers — New Questions
What happened to the figure toolbar? Why is it an axes toolbar? How can I put the buttons back?
From R2018b onwards, tools such as the zoom, pan, datatip, etc are no longer at the toolbar at the top of the figure window. These buttons are now in an "axes" toolbar and only appear when you hover your mouse over the plot. How do I put the buttons back at the top of the figure window?From R2018b onwards, tools such as the zoom, pan, datatip, etc are no longer at the toolbar at the top of the figure window. These buttons are now in an "axes" toolbar and only appear when you hover your mouse over the plot. How do I put the buttons back at the top of the figure window? From R2018b onwards, tools such as the zoom, pan, datatip, etc are no longer at the toolbar at the top of the figure window. These buttons are now in an "axes" toolbar and only appear when you hover your mouse over the plot. How do I put the buttons back at the top of the figure window? figure, toolbar, axes, missing MATLAB Answers — New Questions
How to extract numbers from image with reflections and artifacts?
Hello.
I have a series of photos of the seven-digit display (below please find the example of such photo). I want to apply OCR to extract the information from each consecutive frame. Generally, the methods works quite fine provided that the image is distinct. Hovewer, at the preprocessing stage there is a need to binarize the image. The problem lies in a fact that there are some reflections in the image. I spent a significant amount of time and tried a lot of combinations and various functions (e.g. adaptive thresholding, histograms) to obtain the best possible performance. Is there any reasonable method for obtaining a nice set of digits without artifacts? Unfortunately there is no way to repeat the experiments in better conditions and remove the reflections at acqusition stage.
Thank you kindly in advance for any useful suggestions.Hello.
I have a series of photos of the seven-digit display (below please find the example of such photo). I want to apply OCR to extract the information from each consecutive frame. Generally, the methods works quite fine provided that the image is distinct. Hovewer, at the preprocessing stage there is a need to binarize the image. The problem lies in a fact that there are some reflections in the image. I spent a significant amount of time and tried a lot of combinations and various functions (e.g. adaptive thresholding, histograms) to obtain the best possible performance. Is there any reasonable method for obtaining a nice set of digits without artifacts? Unfortunately there is no way to repeat the experiments in better conditions and remove the reflections at acqusition stage.
Thank you kindly in advance for any useful suggestions. Hello.
I have a series of photos of the seven-digit display (below please find the example of such photo). I want to apply OCR to extract the information from each consecutive frame. Generally, the methods works quite fine provided that the image is distinct. Hovewer, at the preprocessing stage there is a need to binarize the image. The problem lies in a fact that there are some reflections in the image. I spent a significant amount of time and tried a lot of combinations and various functions (e.g. adaptive thresholding, histograms) to obtain the best possible performance. Is there any reasonable method for obtaining a nice set of digits without artifacts? Unfortunately there is no way to repeat the experiments in better conditions and remove the reflections at acqusition stage.
Thank you kindly in advance for any useful suggestions. binarize, thresholding, image processing MATLAB Answers — New Questions
Type Simulink.metamodel.foundation.ValueType issue with Adaptive Autosar System Composer architecture.
I’m using Simulink 22b system composer for Autosar architecture.
When trying a model update I get this error:
Simulink.metamodel.arplatform.common.ModeDeclarationGroup of value [noname](__). Please report this to MathWorks.
I saw you answered "I would like to let you know that this is a known bug and I apologize for this experience. The fix for the same is released in R2022b Update 6, R2023a Update 3 as well as R2023b. Please update the MATLAB to any of the above version to resolve the issue.".
My SW version is Update 9, but stil have a problem.
What could be the source of it, and how could I possibly fix it? I can’t find anything on Simulink.metamodel.I’m using Simulink 22b system composer for Autosar architecture.
When trying a model update I get this error:
Simulink.metamodel.arplatform.common.ModeDeclarationGroup of value [noname](__). Please report this to MathWorks.
I saw you answered "I would like to let you know that this is a known bug and I apologize for this experience. The fix for the same is released in R2022b Update 6, R2023a Update 3 as well as R2023b. Please update the MATLAB to any of the above version to resolve the issue.".
My SW version is Update 9, but stil have a problem.
What could be the source of it, and how could I possibly fix it? I can’t find anything on Simulink.metamodel. I’m using Simulink 22b system composer for Autosar architecture.
When trying a model update I get this error:
Simulink.metamodel.arplatform.common.ModeDeclarationGroup of value [noname](__). Please report this to MathWorks.
I saw you answered "I would like to let you know that this is a known bug and I apologize for this experience. The fix for the same is released in R2022b Update 6, R2023a Update 3 as well as R2023b. Please update the MATLAB to any of the above version to resolve the issue.".
My SW version is Update 9, but stil have a problem.
What could be the source of it, and how could I possibly fix it? I can’t find anything on Simulink.metamodel. adaptive autosar MATLAB Answers — New Questions
Why fixed values are not working in randomstart function of trainDDPGrobot program?
I am new to reinforcement learning and have run the programs given in online ramp course of reinforcement learning. In the randomstart function I made only a single change as given in the code below but the program is giving the attached image. I have seen the documentation, where all examples are given with random numbers. But I all inputvariables i.e. x0, y0, theta0, v0, and w0 to be fix and should be picked from already stored vectors, When I tried to fix only with single variable x0, the program is generating an error. How can I fix it?
function in = randomstart(in)
mdl = "whrobot";
a=0.5;
% in = setVariable(in,"x0",((-1)^randi([0 1]))*(2.5 + 3.5*rand),"Workspace",mdl);
in = setVariable(in,"x0",a,"Workspace",mdl);
in = setVariable(in,"y0",2.6 + 3.4*rand,"Workspace",mdl);
in = setVariable(in,"theta0",pi*(2*rand-1),"Workspace",mdl);
in = setVariable(in,"v0",randn/3,"Workspace",mdl);
in = setVariable(in,"w0",randn/3,"Workspace",mdl);
disp(x0)
endI am new to reinforcement learning and have run the programs given in online ramp course of reinforcement learning. In the randomstart function I made only a single change as given in the code below but the program is giving the attached image. I have seen the documentation, where all examples are given with random numbers. But I all inputvariables i.e. x0, y0, theta0, v0, and w0 to be fix and should be picked from already stored vectors, When I tried to fix only with single variable x0, the program is generating an error. How can I fix it?
function in = randomstart(in)
mdl = "whrobot";
a=0.5;
% in = setVariable(in,"x0",((-1)^randi([0 1]))*(2.5 + 3.5*rand),"Workspace",mdl);
in = setVariable(in,"x0",a,"Workspace",mdl);
in = setVariable(in,"y0",2.6 + 3.4*rand,"Workspace",mdl);
in = setVariable(in,"theta0",pi*(2*rand-1),"Workspace",mdl);
in = setVariable(in,"v0",randn/3,"Workspace",mdl);
in = setVariable(in,"w0",randn/3,"Workspace",mdl);
disp(x0)
end I am new to reinforcement learning and have run the programs given in online ramp course of reinforcement learning. In the randomstart function I made only a single change as given in the code below but the program is giving the attached image. I have seen the documentation, where all examples are given with random numbers. But I all inputvariables i.e. x0, y0, theta0, v0, and w0 to be fix and should be picked from already stored vectors, When I tried to fix only with single variable x0, the program is generating an error. How can I fix it?
function in = randomstart(in)
mdl = "whrobot";
a=0.5;
% in = setVariable(in,"x0",((-1)^randi([0 1]))*(2.5 + 3.5*rand),"Workspace",mdl);
in = setVariable(in,"x0",a,"Workspace",mdl);
in = setVariable(in,"y0",2.6 + 3.4*rand,"Workspace",mdl);
in = setVariable(in,"theta0",pi*(2*rand-1),"Workspace",mdl);
in = setVariable(in,"v0",randn/3,"Workspace",mdl);
in = setVariable(in,"w0",randn/3,"Workspace",mdl);
disp(x0)
end reinforcement learning, input, env MATLAB Answers — New Questions