https://uk.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions2018-02-21T19:11:02Ztag:uk.mathworks.com,2005:Question/3840462018-02-21T19:08:58Z2018-02-21T19:08:58Zimshow in app designer is not working<p>I am trying to show the first frame of a video on a gui in app designer. So far, everything seems to process, and I am not receiving any errors, but the image I want is not showing. All I get is the UIAxes disapears, and nothing shows up.</p>qiana curcuruhttps://uk.mathworks.com/matlabcentral/profile/authors/11058296-qiana-curcurutag:uk.mathworks.com,2005:Question/3838482018-02-21T01:34:25Z2018-02-21T19:07:06ZHow go compile and run generated C++ code in Microsoft Visual Studio 2013<p>What I want to do is simple.</p><p>1. Generated C++ code using Matlab Coder.
2. Create new project in Microsoft Visual Studio 2013.
3. Add all the generated files into new project
4. Add the Matlab setting as following:
* Add Include path: C:\Program Files\MATLAB\R2017b\extern\include
* Add library path:C:\Program Files\MATLAB\R2017b\extern\lib\win64\microsoft
* Add library:
libmx.lib libmat.lib libeng.lib (also tried mclmcrrt.lib)</p><p>When compiling, give me the following error:
Error 15 error LNK2019: unresolved external symbol _mexAtExit referenced in function _mexFunction C:\Work\VP_Touch\E2E\Matlab\matlab_214_LC_updated\itouch-e2e-master\codegen\lib\afe_entry\Matlab_Example\Matlab_Example\_coder_afe_entry_mex.obj Matlab_Example
Error 10 error LNK2019: unresolved external symbol _emlrtSetField referenced in function _emlrtMexFcnProperties C:\Work\VP_Touch\E2E\Matlab\matlab_214_LC_updated\itouch-e2e-master\codegen\lib\afe_entry\Matlab_Example\Matlab_Example\_coder_afe_entry_info.obj Matlab_Example</p><p>...</p><p>How to address it? I googled it and cannot find the answer.
Really appreciate it!</p>Lukai Caihttps://uk.mathworks.com/matlabcentral/profile/authors/12021413-lukai-caitag:uk.mathworks.com,2005:Question/3476092017-07-06T13:20:06Z2018-02-21T19:05:24ZHow to manually modify weights in a SeriesNetwork?<p>For some of my studies on deep neural nets, I need to change select weights in a (previously trained) SeriesNetwork by hand, and evaluate changes in the classification results. Ideally, I would like to do</p><pre> net.Layers(k).Weights = W;</pre><p>where net is a SeriesNetwork (a class in the Neural Network Toolbox), k is an integer that indexes a fully connected layer, and W is a suitable array. I would then classify inputs with the net modified in this way.</p><p>However, the field net.Layers(k).Weights is read-only, so the instruction above will generate the following error message:</p><pre> You cannot set the read-only property 'Layers' of SeriesNetwork.</pre><p><i>Is there some way to circumvent this restriction?</i></p><p>Here is what I tried, to no avail: First define an array of Layers by saying something like this:</p><pre> layers = [imageInputLayer([28 28 1])
% Severa layers here
classificationLayer()];</pre><p>then initialize the weights as desired, and finally make these layers into a SeriesNetwork with the class’s constructor:</p><pre> net = SeriesNetwork(layers);</pre><p>While this does create a new SeriesNetwork, attempting to classify an input with</p><pre> y = classify(net, x);</pre><p>where x is a suitable input results in the following error message:</p><pre> Error using nnet.internal.cnn.layer.FullyConnected/forwardPropagateSize (line 99)
An input size for the layer must be defined in order to call forwardPropagateSize.</pre><pre> Error in SeriesNetwork>iDetermineLayerOutputSize (line 417)
inputSize = layers{i}.forwardPropagateSize(inputSize);</pre><pre> Error in SeriesNetwork/get.OutputSize (line 80)
val = iDetermineLayerOutputSize( internalLayers, outputLayerIdx );</pre><pre> Error in SeriesNetwork/predict (line 185)
Y = precision.cast( zeros([this.OutputSize dispatcher.NumObservations]) );</pre><pre> Error in SeriesNetwork/classify (line 250)
scores = this.predict( X, varargin{:} );</pre><p><i>What is missing in my use of the constructor to make net a fully-fledged SeriesNetwork that can be used with classify?</i></p>Carlo Tomasihttps://uk.mathworks.com/matlabcentral/profile/authors/25866-carlo-tomasitag:uk.mathworks.com,2005:Question/3840432018-02-21T19:02:21Z2018-02-21T19:03:57ZHow to export figure as Georeferenced tiff<p>I need help to export a plot figure that I have made with quiver function as a georeferenced tif.</p><p>dav_dt.XComp and dav_dt.YComp is a 3D-array with size of 721x23x44.
U_mean and V_mean are the mean velocities with size of 1x23x44
the size of the grid Long Lat is 216x301</p><pre class="language-matlab">if true
clear all
clc
% Grid extent 3D Model:
%
%29 of november - 14 december > 8689:9409
% m: 75:97
% n: 35:78
%loading files
output = 'D:\Gui_mestrado\Delft3D_data\Matlab\';
filemodel = 'D:\Delft3D_CEP\Mihael\';
trim = qpfopen([filemodel 'trim-TimeScales_CEP.dat']);
dav_dt = qpread(trim, 1, 'depth averaged velocity', 'data', 8689:9409, 75:97, 35:78);
sz = length(dav_dt.XComp(:,1));
G = wlgrid('read','D:\Delft3D_CEP\Mihael\grid.grd');
[long, lat] = convertCoordinates(G.X, G.Y, 'CS1.code', 29192, ...
'CS2.code', 4326);
U_mean = mean(dav_dt.XComp);
V_mean = mean(dav_dt.YComp);
c = sqrt(U_mean.^2+V_mean.^2);
colquiver(quiver(long(75:97, 35:78),lat(75:97, 35:78),squeeze(U_mean),squeeze(V_mean)), c);%,sqrt(squeeze(U_mean).^2+squeeze(V_mean))
daspect([1,1,1]);
</pre><pre class="language-matlab">end
</pre>Guilherme Cruzhttps://uk.mathworks.com/matlabcentral/profile/authors/5155224-guilherme-cruztag:uk.mathworks.com,2005:Question/3840452018-02-21T19:03:40Z2018-02-21T19:03:40ZHow can I do a color display of an array of unsigned 32 bit integer values?<p>Hello,</p><p>I'm doing my own radon transform algorithm on an embedded processor, where I input a NxM (N rows, M cols) 8 bit per pixel grayscale image & I output the radon transform of the image as an array of unsigned 32-bit integer values which I can store into a file. Each row of the output is of size sqrt(M*M + N*N). The number of output rows correspond to the angle range of the radon transform. I would like to take this output file & visualize it the same way as Matlab's radon() function does. Any suggestions?</p>Mark Utterhttps://uk.mathworks.com/matlabcentral/profile/authors/12204496-mark-uttertag:uk.mathworks.com,2005:Question/3840422018-02-21T19:00:09Z2018-02-21T19:03:24ZUntil loop with text variable<p>Hi all,</p><p>I have a vector that has a list of words in it that correlate to values. The file is attached.</p><p>What I want to do, is be able to run a certain command UNTIL the vector sees a change. Is there a way to make an equivalent of an until loop to do something like this? The deteils column my code references has text that would look like: _1/4, HALF, _WOT.</p><p>What I want is to create a separate vector that lists corresponding numerical values for each term mentioned above. For instance:</p><p>'HALF' = .5</p><p>'_1/4' = .25 etc.</p><p>To reiterate, if there is a section of, lets say, 10 rows where Command = 'HALF', then I want to create a second vector that has corresponding '.5' for each of those rows.</p><p>With that in mind, I think the idea of an UNTIL loop would make sense. Matlab would see that the Command value equals something, so that the corresponding vector has a said value. It would only vchange once the Command value changes. Does anybody have an idea how to do this?</p><pre> TargetAPq = .25;
TargetAPh = .5;
TargetAPWOT = 1;
%----------------------------------------------------
% for Command = 'Acceleration'
% for Deteils = 'Half'
% TargetAP = TargetAPh
% end
% for Deteils = '_1/4'
% TargetAP = TargetAPq
% end
% for Deteils = '_WOT'
% TargetAP = TargetAPWOT
% end
% end</pre>Dylan Meccahttps://uk.mathworks.com/matlabcentral/profile/authors/8600954-dylan-meccatag:uk.mathworks.com,2005:Question/3840442018-02-21T19:02:51Z2018-02-21T19:02:51ZTrying to plot an approximation of x(t)<p>I am trying to answer this question where a=3 and b=2</p><img src = "/matlabcentral/answers/uploaded_files/105731/Capture4.JPG"><img src = "/matlabcentral/answers/uploaded_files/105728/Capture1.JPG"><img src = "/matlabcentral/answers/uploaded_files/105729/Capture2.JPG"><p>and here is my code I have made so far</p><pre class="language-matlab">syms x k n;
b = @(f,x,k) int(f*cos(k*pi/2*x)/2,x,-3,1);
c = @(f,x,k) int(f*sin(k*pi/2*x)/2,x,-3,1);
xt = @(f,x,n) b(f,x,0) + symsum(b(f,x,k)*cos(k*pi/2*x)+c(f,x,k)*sin(k*pi/2*x),k,1,n);
time = -2:0.5:2;
f= sawtooth(pi*time);
numTerms=1; %1,10,25,50
ezplot(xt(f,x,numTerms),-2,2)
</pre><p>but I keep getting an error when i run it and I'm not exactly sure what I'm doing wrong.</p><img src = "/matlabcentral/answers/uploaded_files/105730/Capture.JPG">Joshua Sayrehttps://uk.mathworks.com/matlabcentral/profile/authors/6823227-joshua-sayretag:uk.mathworks.com,2005:Question/3838422018-02-20T23:55:00Z2018-02-21T19:01:57ZFitting of multiple data sets with different lengths<p>Hello all,</p><p>I want to fit several sets of data with varying lengths to <b>a single curve</b>. They are independent repeated sets achieved from experiment shown by the graph (The dashed and the solid lines make no difference). To address the key of my question, only 3 sets are given as following. Could you show me a thought please? Thank you all.</p><pre class="language-matlab">X1=[0 ,20 ,40 ,54.78];
Y1=[5.31,5.12,2.98 ,0 ];
X2=[0 ,20 ,40 ,60 ,69.66];
Y2=[6.29,6.15,4.90,1.68 ,0 ];
X3=[0 ,20 ,40 ,60 ,80 ,84.52];
Y3=[6.39,6.30,5.50 ,3.30,0.38 ,0 ];
</pre><img src = "/matlabcentral/answers/uploaded_files/105592/20180220_234748857_iOS.jpg">zhi liuhttps://uk.mathworks.com/matlabcentral/profile/authors/8129251-zhi-liutag:uk.mathworks.com,2005:Question/3838792018-02-21T04:54:15Z2018-02-21T19:00:31ZHow to reduce the time consumption of GA with constraints satisfaction?<p>I am doing optimization using genetic algorithm, i'm getting results but if i increase the population size it takes more time to converge(around 6hrs).i have population size 4000 and generations 40000 and still constraints are not satisfied so i want to increase the population size. Is there any alternative method to reduce the time consumption??</p>Shreekanth Vhttps://uk.mathworks.com/matlabcentral/profile/authors/12043270-shreekanth-vtag:uk.mathworks.com,2005:Question/3840412018-02-21T18:55:32Z2018-02-21T19:00:13ZHow to make contour3(x,y,z) plot from this experimental data <p>How do I make a contour3(x,y,z) plot from this experimental data generate externally. What commands do I use.</p><pre class="language-matlab">3.73125 18.37375 4
3.73125 13.12375 5
3.73125 7.87375 7
3.73125 2.62375 5
11.19375 18.37375 14
11.19375 13.12375 9
11.19375 7.87375 7
11.19375 2.62375 4
18.65625 18.37375 5
18.65625 13.12375 8
18.65625 7.87375 7
18.65625 2.62375 7
26.11875 18.37375 6
26.11875 13.12375 5
26.11875 7.87375 4
26.11875 2.62375 3
</pre>Kenneth Brownhttps://uk.mathworks.com/matlabcentral/profile/authors/3605304-kenneth-browntag:uk.mathworks.com,2005:Question/945982009-06-27T01:11:00Z2018-02-21T18:56:42ZIs there a function that calculates circular cross-correlation of sequences?<p>I know that XCORR calculates linear cross-correlation function estimates, but I wonder if there is a function that calculates circular correlation.</p>MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/969732009-06-27T01:11:00Z2018-02-21T18:50:45ZHow can I concatenate or merge two structures?<p>I would like to merge two structures into a new structure containing all the fields of the two original structures. How can I do this in MATLAB?</p>MathWorks Support Teamhttps://uk.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:uk.mathworks.com,2005:Question/3838302018-02-20T23:20:26Z2018-02-21T19:11:02Zusinf fft shift i need only to display the positive part of the spectrum<p>I would like to display only the positive part of the frequency domain</p><pre class="language-matlab">if true
%
fs=1e5; %Sampling Frequency
t=0:1/(fs):0.001; %Time at which signal displays
%First,generating a signal
f=1e4;%Signal is 10kHz
amp_signal=1;
signal=amp_signal*(sin(2*pi*f*t));
%Frequency Domain of transmitted signal
transmited_signal_fft=fft(signal);
transmited_signal_fft=fftshift(transmited_signal_fft);
f_axis=linspace(-fs/2,fs/2,length(transmited_signal_fft));
%Plotting Signal
figure;
subplot(2,1,1);
plot(t,signal);
grid on;
title('Transmitted signal in time domain')
%Display transmitted signal in frequency domain
subplot(2,1,2);
plot(f_axis,abs(transmited_signal_fft)/length(signal));
grid on;
title('Transmitted signal in frequency domain')
</pre><pre class="language-matlab">end
</pre><p>Thanks in advance</p>Mohamed Ashrafhttps://uk.mathworks.com/matlabcentral/profile/authors/9237053-mohamed-ashraftag:uk.mathworks.com,2005:Question/3837952018-02-20T20:24:04Z2018-02-21T18:42:17ZNested For Loop Help Please<p>Hey All hope you can help</p><p>I am having trouble getting data stored from my initial loop which I want to use in a later loop.
The initial loop produces 40 sets of unique 2*2 matrix (A).</p><p>I am also struggling with being able to call the Matrix (A) in my nested loop i.e. I want to call the entire matrix and not just values within the matrix.
My internal loop within the nested matrix works I just need the outer loop to work.</p><p>for example- A1= [0 1; 1.5 4] and A2= [0 1; 1 5.6] etc and i want to be able to call
A1* .... etc
A2 *... etc</p><p>Thank you in advance!</p><pre class="language-matlab">zita =0.05; %inherrent damping
m= 773; %mass in MG
b=[0
1/m];
</pre><pre class="language-matlab">for T0=0.1:0.1:4; % Range of Time Periods defined in seconds
w = (2*pi)/T0; %rad/s
w2=w*w;
zita=0.05;
A=[0 1
-w2 -(2*zita*w)];
</pre><pre class="language-matlab">end
</pre><pre class="language-matlab">%nested loop to calculate the displacements with the corresponding A matrix
for % I need to call the A matrix here
for i=1:(NPTS_interp-1)% Runge-Kutta loop, i = incremental time step
</pre><pre> g1 = A*yt(:,i)+b*ft_interp(i);
g2 = A(1:end)*(yt(:,i)+ 0.5*g1*dt_interp)+0.5*b*(ft_interp(i)+ft_interp(i+1));
g3 = A(1:end)*(yt(:,i)+ 0.5*g2*dt_interp)+0.5*b*(ft_interp(i)+ft_interp(i+1));
g4 = A(1:end)*(yt(:,i)+g3*dt_interp)+b*ft_interp(i+1);</pre><pre> ynew = yt(:,i)+(g1+2*g2+2*g3+g4)*dt_interp/6;
yt(:,i+1)=ynew; %storage
ut=yt(1,:); %displacement values
vt=yt(2,:);%velocity values
[pks,locs]=findpeaks(ut,t_interp);
Max_displacement=max(pks);
end
end</pre>Serena Solankihttps://uk.mathworks.com/matlabcentral/profile/authors/10046666-serena-solankitag:uk.mathworks.com,2005:Question/3838732018-02-21T04:25:29Z2018-02-21T18:37:52ZDetermine if valid initial guess for closed numerical method<p>If I'm given a function f(x), how can I determine whether say [0 1] or [1,2 ] are valid initial guesses for a closed numerical method, of solving f(x)=0.</p>Rachel Dawnhttps://uk.mathworks.com/matlabcentral/profile/authors/11963433-rachel-dawntag:uk.mathworks.com,2005:Question/3143862016-11-28T16:40:38Z2018-02-21T18:36:17ZComputing second moment of area from image of beam cross section<p>I need to compute bending properties such as the second moments of area and the Saint-Venant torsion constant (Ixx, Iyy, J) of a beam from an image of the cross section. The beam is actually a bicycle rim and the images are from wheel technical sales literature. I am envisioning a routine that imports and image, scales it, locates the edges, displays the result for a visual check, and then integrates the appropriate functions across the cross sectional area.</p><p>Has anyone already done this or something similar?</p>Thomas Wilsonhttps://uk.mathworks.com/matlabcentral/profile/authors/441212-thomas-wilsontag:uk.mathworks.com,2005:Question/3840392018-02-21T18:36:01Z2018-02-21T18:36:01ZI can't get a graph from my code<pre class="language-matlab">n=0;
t(1)=0;
T(1)=50;
Tout=375;
k=0.0035;
h=30;
</pre><pre class="language-matlab">while T<160
n=n+1;
slope=-k.*(T(n)-Tout);
t_1(n+1)=t(n)+h;
T_1(n+1)=T(n)+h*slope;
end
</pre><pre class="language-matlab">h=15;
while T<160
n=n+1;
slope=-k*(T(n)-Tout);
t_2(n+1)=t(n)+h;
T_2(n+1)=T(n)+h*slope;
end
</pre><pre class="language-matlab">h=5;
while T<160
n=n+1;
slope=-k*(T(n)-Tout);
t_3(n+1)=t(n)+h;
T_3(n+1)=T(n)+h*slope;
end
</pre><pre class="language-matlab">plot(t_1,T_1,'r') %x-data: time; y-data: temps
hold on
plot(t_2,T_2,'g')
plot(t_3,T_3,'b')
title ('Temperature Measurements') %add title
xlabel('Time, minutes') %label x-axis
ylabel('Temperature, Degrees F') %label y-axis
grid
</pre>Mario Echevarriahttps://uk.mathworks.com/matlabcentral/profile/authors/8807952-mario-echevarriatag:uk.mathworks.com,2005:Question/3840182018-02-21T16:34:27Z2018-02-21T18:34:52ZHow do I read strings with textscan?<p>I have the following format I'm trying to read from a file with textscan:</p><p>10000 'name1 name2 name3 ..' 3 4 5 6 7 8 9 10 11</p><p>20000 'name4 name5 ..' 3 4 5 6 7 8 9 10 11</p><p>30000 'name6 name7 name8 name9 ..' 3 4 5 6 7 8 9 10 11</p><p>repeat format for 150 lines</p><p>The issue is I want everything between single quotes to be read/stored as one string. The problem is that there are whitespaces and also sometimes there are 3 names, sometimes there are 2, sometimes 4.</p><p>I've tried:</p><p>formatSpec = '%d %s %f %f %f %f %f %f %f %f %f'</p><p>C = textscan(fid,formatSpec,150)</p><p>I know my formatSpec is too basic for strings with multiple whitespaces and words. Can you help with how I should read in this format? I basically want C to be an 150x11 cell matrix where column 2 is the entire string from single quote to single quote.</p><p>Thanks!</p>kygreenhttps://uk.mathworks.com/matlabcentral/profile/authors/11218780-kygreentag:uk.mathworks.com,2005:Question/3840372018-02-21T18:28:11Z2018-02-21T18:30:20ZTranslational Hydro-Mechanical Converter with variable area.<p>I would like to create a custom component, similar to the Translational Hydro-Mechanical Converter, however, I'd like it to accept an external area value to be used as the parameter that converts the hydraulic pressure to a force. The intent is to be able to vary the area throughout the simulation.</p><p>I have tried modifying the source code for the component to achieve this but do not have enough of a fundamental understanding of the language to do so. How can define an input and communicate that input to the internal component "chose_converter"?</p><p>Something like this:</p><p>component translational_converter_area</p><p>if true</p><p>% Translational Hydro-Mechanical Converter
% The block models an ideal transducer that converts hydraulic
% energy into mechanical energy in the form of translational motion of the
% converter output member.
% Fluid compressibility can be accounted for and the pressure variation due
% to density fluctuations dynamically solved. This does not require the
% addition of a chamber block.
%
% Port A is a hydraulic conserving port associated with the converter
% inlet. Ports R and C are mechanical translational conserving ports
% associated with the rod and the body of the converter, respectively.
% Pressure at port A generates force in the direction specified by the
% Converter orientation parameter.</p><p>% Copyright 2013-2016 The MathWorks, Inc.</p><p>inputs
AR = {1e-3, 'in^2'}; % AR:left
end</p><p>nodes
C = foundation.mechanical.translational.translational; % C:left
A = foundation.hydraulic.hydraulic; % A:left
R = foundation.mechanical.translational.translational; % R:right
end</p><p>parameters
area = AR; % Piston area
or = { 1, '1' }; % Converter orientation
compressibility = { 0, '1' }; % Compressibility
init_pos = { 0, 'm' }; % Piston initial position
V_dead = { 1e-4, 'm^3' }; % Dead volume
k_sh = { 1.4, '1' }; % Specific heat ratio
initial_pressure = { 0, 'Pa' }; % Initial pressure
end</p><p>if ~compressibility
equations
% Assertions
assert(area > 0);
end</p><pre> components
chosen_converter = foundation.hydraulic.elements.translational_converter_incompressible...
(area=area, or=or);
end </pre><p>else
equations
% Assertions
assert(area > 0)
assert(V_dead > 0)
assert(k_sh >= 1)
assert(k_sh < 2)
assert(init_pos >= 0)
assert(initial_pressure >= {-1, 'atm'})
end</p><pre> components
chosen_converter = foundation.hydraulic.elements.translational_converter_compressible...
(area=area, or=or, init_pos=init_pos, V_dead=V_dead, k_sh=k_sh,...
initial_pressure=initial_pressure);
end
end</pre><p>connections
connect(chosen_converter.A,A);
connect(chosen_converter.C,C);
connect(chosen_converter.R,R);
end</p><p>end
end
---------End of Code-----------</p><p>In the original code the input is not invoked and the parameter 'area' has a constant value. The modified version does not work (AR faults out as 'undefined') but I lack the understanding of the way the code communicates information to make it work.</p><p>Are there any suggestions or similar exercises I can use as reference?</p>Oscar Penahttps://uk.mathworks.com/matlabcentral/profile/authors/10516671-oscar-penatag:uk.mathworks.com,2005:Question/3839962018-02-21T15:24:06Z2018-02-21T18:27:16Zhow to find the roots of polynomial equations with coefficients of variable is given in matrix form?<p>Hi,</p><p>I am a beginner in using MATLAB.
I would like to know how do you write in MATLAB the polynomial equation below? I am solving for the values (i.e. roots) of z:</p><p>Az^3 + Bz^2 +Cz = 0</p><p>Note: A, B, C & D are in matrix form, as shown below:</p><p>A = [2,1;1,2]
B = [-3,0;-2,-5]
C = [-2,-4;0,2]
D = [0,0;0,0]</p><p>Thanks in advance for your help.</p>Lawrence Galvezhttps://uk.mathworks.com/matlabcentral/profile/authors/11477885-lawrence-galveztag:uk.mathworks.com,2005:Question/3840242018-02-21T17:00:47Z2018-02-21T18:22:47Zhow to build low-pass and high pass filter cubic B-spline matlab<p>Hello, I am trying to build a cubic B-spline high pass filter to use it in the wavelet decomposition of images, in some references I found a low pass cubic B-spline filter like this</p><p>Low_pass = [1/16 1/4 3/8 1/4 1/16];
what would be the high pass filter of this low pass filter ?????</p><p>is it like this
high_pass = [-1/16 1/4 -3/8 1/4 -1/16];????</p>kareem ostahttps://uk.mathworks.com/matlabcentral/profile/authors/2051700-kareem-ostatag:uk.mathworks.com,2005:Question/3840122018-02-21T16:00:37Z2018-02-21T18:22:07ZHow to replace table cell values with cell value multiplied by 0.0254?<p>I want to look through the rows, find a specific text. If that text exists, then go to column 4 to 6 and replace those values by multiplying that value by 0.0254. How can I do that? I have this code but it doesn't work</p><pre class="language-matlab">num_rows = size(HabEx3P,1);
num_cols = size(HabEx3P,2);
for i = 1:1:num_rows
if ~exist('GRID','var')
for j = 4:1:6
HabEx3P(:,j) = HabEx3P(:,j).*0.0254;
end
end
end
</pre>Hao Tanghttps://uk.mathworks.com/matlabcentral/profile/authors/6577328-hao-tangtag:uk.mathworks.com,2005:Question/3840192018-02-21T16:35:05Z2018-02-21T18:19:27ZWhy is my function giving me the wrong output?<p>I was asked to write a function finding median and mean of an array without using the built in functions or the sum function. I think my code is very close to being correct, however I am confused as to why it is giving me the output zero when it should be giving me a 3. The array I tested it with was [5 8 9 1 0 2 3 1 9]. I then tried to sort it in ascending order and index it to find the median value. When I hover the cursor over the line</p><pre class="language-matlab">medianValue = sortedArray(medianIndex);
</pre><p>it shows the array as sorted. So basically, I don't know why my medianValue = 0 when it should equal 3. I think that part of my function is correct because it should be indexing the sorted array at the value for medianIndex, which is 5. So it should be returning the value 3.</p><pre> function [meanValue, medianValue] = statsFunction(array)
%function to calculate median and mode values of an array</pre><pre> sortedArray = sort(array, 'ascend');
numElements = numel(sortedArray);</pre><pre> if mod(numElements, 2) ~= 0</pre><pre> medianIndex = (numElements+1)/2;
medianValue = sortedArray(medianIndex);</pre><pre> else
medianIndex1 = numElements/2;
medianIndex2 = (numElements+1)/2;</pre><pre> medianValue = (medianIndex1 + medianIndex2) / numElements;</pre><pre class="language-matlab">end
</pre><pre> sumx = 0;
k = 1;
while k <= length(array)
sumx = sumx + array(k);
k = k+1;</pre><pre> end</pre><pre> meanValue = sumx/(length(array));</pre>Kristen O'Marahttps://uk.mathworks.com/matlabcentral/profile/authors/11973585-kristen-o-maratag:uk.mathworks.com,2005:Question/3835602018-02-19T18:30:35Z2018-02-21T18:18:23ZI want to read in an Excel table with heterogeneous data types<p>I can't find a format example, IO need to read in a data format, some string fields and double precision variables. What does the format option look like? e.g. %d. This is my code so far:</p><pre class="language-matlab">fname='Curves 02.13.18.xls';
T=readtable(fname,'ReadRowNames',true,format,{%d});
Bid = T(:,7);
Ask = T(:,8);
Mid = T(:,9);
Settle = T(1,1);
</pre>Julian Gammon IIIhttps://uk.mathworks.com/matlabcentral/profile/authors/11215005-julian-gammon-iiitag:uk.mathworks.com,2005:Question/3837312018-02-20T14:32:44Z2018-02-21T18:18:06ZHow would I improve my euler code? <p>How can i improve my euler code? Code is attached ... I believe i have to improve it by using trapezoids instead of rectangles..How do i do this ? Can someone help</p>Raiven Balderashttps://uk.mathworks.com/matlabcentral/profile/authors/11936541-raiven-balderastag:uk.mathworks.com,2005:Question/3837532018-02-20T16:30:52Z2018-02-21T18:16:02ZHow can I come to know that the Constraints are satisfied in Pattern Search algorithm?<p>Hi I am using Patternsearch algorithm to find minimum value of objective function.
Pattern Search algorithm terminates when number of generations exceeds.
How can I come to know that the Constraints are satisfied?</p>Dhanu Naikhttps://uk.mathworks.com/matlabcentral/profile/authors/10932608-dhanu-naiktag:uk.mathworks.com,2005:Question/3839972018-02-21T15:26:14Z2018-02-21T18:12:52ZHow to create array with unequal spacing?<p>I want to create an array with unequal spacing. I have h = 1 1/2 1/4 1/8 ..... 2^-60.</p><p>Every second entry in this array is 1/2 of the last one. I only know, how to make arrays with equal spacing.</p><p>a = 1:5:40</p><p>But how do I create array that gets halved with every entry?</p>Ahmad Hasnainhttps://uk.mathworks.com/matlabcentral/profile/authors/12103865-ahmad-hasnaintag:uk.mathworks.com,2005:Question/811882013-07-05T08:42:41Z2018-02-21T18:07:40ZWhy is "undefined" a variable that I have previously defined???<p>Hello,
I use a variable 'd' in a function F, such that this variable 'd' is defined as an input of this function F. In F, 'd' is used only in a sub-function G, where acts as an input of G. However, if I ask for the value of 'd' in F, there is no problem to get it, while Matlab says me that 'd' is "undefined" when it tries to use it in G. Does someone knows why? Thank you in advance for your help.</p><p>Ad'</p>Adrienhttps://uk.mathworks.com/matlabcentral/profile/authors/4260469-adrientag:uk.mathworks.com,2005:Question/3625472017-10-21T23:41:44Z2018-02-21T18:05:28ZHow to plot high resolution?<p>I would like to plot a histogram with 2048 bins. Is it possible plot and save it? pdf? retina display</p>Mr M.https://uk.mathworks.com/matlabcentral/profile/authors/4980938-mr-mtag:uk.mathworks.com,2005:Question/3839262018-02-21T09:56:33Z2018-02-21T18:04:47Zhow to stop several for loop at a time in matlab? i want to break out of the loop when if statement is satisfied<pre class="language-matlab">clc;clear
for a=1:.01:2
for b=1:.01:2
for c=1:.01:2
for d=1:.01:2
for e=1:.01:2
for f=1:.01:2
x=[-1+a;2+b;c;d;e;f]
if(x(1)>0&&x(2)>0&&x(3)>0&&x(4)>0&&x(5)>0&&x(6)>0)
break;
end
end
end
end
end
end
end
display x
</pre>shouvik deyhttps://uk.mathworks.com/matlabcentral/profile/authors/11244814-shouvik-deytag:uk.mathworks.com,2005:Question/3840362018-02-21T18:03:30Z2018-02-21T18:04:14ZCreate colormap from using coordinates<p>Hello, I have created a map figure using the following commands:</p><p>shi = shaperead('map.shp')</p><p>fig=mapshow(shi, 'FaceColor', 'white')</p><p>I have also done some calculations where I divided the map area into circles with specific radius and calculated a variable in each circle. Now I want to make a colormap using latitude,longitude of the center of the circle and my calculated variable.</p><p>My data looks like this:</p><p>lat=[38.4 38.6 38.8 40 38.4 38.6....
lon=[25 25 25 25 25.2 25.2......
R=[ 20 25 20 20 3025..... %km
var=[1.7 1.3 1.2 1.2 1.1...</p><p>The result has to look something like this.</p><img src = "/matlabcentral/answers/uploaded_files/105724/pic.png"><p>Any ideas? Thanks in advance.</p>Nikos Vavlashttps://uk.mathworks.com/matlabcentral/profile/authors/12211035-nikos-vavlastag:uk.mathworks.com,2005:Question/2180942015-05-22T11:24:45Z2018-02-21T17:58:38ZHow to isolate and display the largest connected component of a 3D triangular mesh ?<p>Hello ,
after segmenting a 3D mesh of a 3D object , there are some parts that i need to get rid of . that's why i m thinking of getting only the biggest segment of mesh ?
can any one ,please , help me ?
thank you</p>Nadia HOSNIhttps://uk.mathworks.com/matlabcentral/profile/authors/6362004-nadia-hosnitag:uk.mathworks.com,2005:Question/3840322018-02-21T17:45:03Z2018-02-21T17:58:19ZI need a multiple GUI in a single one(MAIN) using pushbutton to call them and build a standalone (.exe), it works calling 2 GUIs in a a single one(main) but from the third the .exe does't work. How can I build the .exe using the five GUIs?<pre> function Main_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Main(see VARARGIN)</pre><pre> % Choose default command line output for Main
handles.output = hObject;</pre><pre> % Update handles structure
guidata(hObject, handles);
function varargout = Main_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)</pre><pre> % Get default command line output from handles structure
varargout{1} = handles.output;</pre><pre class="language-matlab">function pushbotton1_callback
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
GUI1
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
GUI2
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%
GUI3
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
GUI4
</pre><p>function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
GUI5</p>Alfredo guerrerohttps://uk.mathworks.com/matlabcentral/profile/authors/4216969-alfredo-guerrerotag:uk.mathworks.com,2005:Question/3425682017-05-30T17:31:11Z2018-02-21T17:53:25ZHow to set different y limits for multiple subplots?<p>I have 12 subplots that I am trying to plot, but when I plot them the axes are all messed up. I would like to set the y-axis based on the min and max value of the data that I am plotting, but I get this error when trying to set the limits</p><pre class="language-matlab">Subscript indices must either be real positive integers or logicals.
</pre><p>This is my code:</p><pre class="language-matlab">for i=1:length(idx)
subplot(4,3,i);
plot(DLG.Data{1,1}(:,1),DLG.Data{1,1}(:,idx(i)));
xlim([0 250]);
min = min(DLG.Data{1,1}(:,idx(i)));
max = max(DLG.Data{1,1}(:,idx(i)));
ylim([min max]);
end
</pre><p>The xlimits are always the same, the only thing that change are the y-limits.</p>Ibro Tutichttps://uk.mathworks.com/matlabcentral/profile/authors/6870135-ibro-tutictag:uk.mathworks.com,2005:Question/3840352018-02-21T17:53:05Z2018-02-21T17:53:05ZFractional order algebraic equations<p>Hi,
I am having a system of two fractional differential equations and an algebraic equation. I would like to solve that system and plot the time series. We defining the algebraic equation in matlab, an error shown as an invalid matlab expression. The code is as follows
function [T, Y]=FOAE(parameters, orders, TSim, Y0)
%</p><p>% time step:
h=0.01;
% number of calculated mesh points:
n=round(TSim/h);
%orders of derivatives, respectively:
q1=orders(1); q2=orders(2); q3=orders(3);
% constants of Duffing's system:
r=parameters(1); k=parameters(2); beta=parameters(3);sigma=parameters(4); a=parameters(5); p=parameters(6); c=parameters(7); m=parameters(8);
% binomial coefficients calculation:
cp1=1; cp2=1; cp3=1;
for j=1:n
c1(j)=(1-(1+q1)/j)*cp1;
c2(j)=(1-(1+q2)/j)*cp2;
c3(j)=(1-(1+q3)/j)*cp3;
cp1=c1(j); cp2=c2(j); cp3=c3(j);
end
% initial conditions setting:
x(1)=Y0(1); y(1)=Y0(2); z(1)=Y0(3);
% calculation of phase portraits /numerical solution/:
for i=2:n
x(i)=(r*x(i-1)*(1-x(i-1)/k)-beta*x(i-1)*y(i-1)/(1+sigma*x(i-1)))*h^q1 - memo(x, c1, i);
y(i)=(beta*x(i-1)*y(i-1)/(1+sigma*x(i-1))-a*y(i-1)-y(i-1)*z(i-1))*h^q2 - memo(y, c2, i);
0 =(z(i-1)*(p*y(i-1)-c)-m)*h^q3 - memo(z, c3, i);
end
for j=1:n
Y(j,1)=x(j);
Y(j,2)=y(j);
Y(j,3)=z(j);
end
T=0:h:TSim;
%%%%%%%%%%%%%%%%%
[t, y]=FOAE([0.2 5 0.2 0.001 0.2 1.5 1 -0.0001], [ 0.8 0.8 0 ], 100, [1.3 0.4 0.00025]);
figure(1)
plot(y(:,1), y(:,2), 'k','Linewidth',3);
fsize=15;
xlabel('x_1(t)','FontSize',fsize); ylabel('x_2(t)','FontSize',fsize); grid;</p><p>%%%%%%%%%%%%%%%%%%%%%%
Any help is really appreciated.
Thank you very much in advance.
Sanaa Moussa</p>Samahttps://uk.mathworks.com/matlabcentral/profile/authors/4443184-samatag:uk.mathworks.com,2005:Question/3715322017-12-06T23:10:47Z2018-02-21T17:52:51ZHow to set the Model History information programmatically?<p>The Model Properties > History tab allows you to uncheck "Read Only" and then make modifications to the "Created by" and "Last saved by" fields (as well as the others).</p><img src = "/matlabcentral/answers/uploaded_files/97665/modelhistory.png"><p>Programmatically, the following code should change the field,</p><pre class="language-matlab">set_param(sys, 'LastModifiedBy', 'Ada');
</pre><p>however this error is thrown:</p><img src = "/matlabcentral/answers/uploaded_files/97666/error2.png"><p>How can these model parameters be changed? Is there a way to programmatically unset the "Read Only" flag?</p>Monika Jaskolka (Bialy)https://uk.mathworks.com/matlabcentral/profile/authors/4417791-monika-jaskolka-bialytag:uk.mathworks.com,2005:Question/3840332018-02-21T17:48:53Z2018-02-21T17:52:50Zhow to calculate entropy in matlab for lossless image compression ?<p>hi, I already perform iwt coding for the lossless image compression with image size 512x512 but I don't know how to calculate the entropy in Matlab coding. can anybody help me? below is my iwt coding;</p>nur aqilahttps://uk.mathworks.com/matlabcentral/profile/authors/11618331-nur-aqilatag:uk.mathworks.com,2005:Question/3840342018-02-21T17:52:36Z2018-02-21T17:52:36ZIn GUIDE, how to correctly save a structure as a "handles" and refer to it later in the code?<p>I have two callback functions (which work fine) defined as follow:</p><pre> function hpos(hObject, pos, handles)
handles.A.L{handles.im}=value1;
guidata(hObject, handles);</pre><pre> function hpos2(hObject, pos, handles)
handles.A.R{handles.im}=value2;
guidata(hObject, handles);</pre><p>Then when I try:</p><pre> disp(handles.A.L,handles.A.R)</pre><p>Only the latest handles exists, as if it overwrote the previous one.
So I get either</p><pre class="language-matlab">"Reference to non-existent field *'L'*."
or
"Reference to non-existent field *'R'*."
</pre><p>depending on what was the last updated field of the structure A.</p><p>Of course the goal is to use these value elsewhere in my code, so understanding how to save them correctly will help a lot!
Thank you!</p>Charleshttps://uk.mathworks.com/matlabcentral/profile/authors/8097199-charlestag:uk.mathworks.com,2005:Question/3839502018-02-21T11:44:08Z2018-02-21T17:52:32ZHow to code this Algorithm?<pre> Please help</pre>Bhavish Jankarhttps://uk.mathworks.com/matlabcentral/profile/authors/12208397-bhavish-jankartag:uk.mathworks.com,2005:Question/3837632018-02-20T17:28:01Z2018-02-21T17:51:40ZFinding category/string in table and converting values <p>Alright so I'm having trouble knowing how to write a script to convert values.</p><p>Basically, I want to
1) Read in a file or Access a table
2) Find all the instances in the rows of the table with the string "CBEAM"
3) In said row, go to the 4th column and multiply that number by 0.5
4) Find all instances in the rows of the table with the string "CQUADR"
5) In said row, go to the 6th column and multiply that number by 0.6</p><p>So I can envision lots of if, then statements, which is totally fine. But I really don't know how to get started or what to write at all. Can anyone help</p>Hao Tanghttps://uk.mathworks.com/matlabcentral/profile/authors/6577328-hao-tangtag:uk.mathworks.com,2005:Question/1786162015-02-16T03:14:41Z2018-02-21T17:41:28ZHow generate a prism with a fibres random distributions inside in Matlab?<p>Hi!i need to solve this problem:</p><p>I have a prism 150x150x550mm made of concrete plus 1715 steel fibres spread inside.
Each fibre has a cylindrical shape with circular section of 0,8 mm and 55mm in length.</p><p>The question is: how many fibres i theoretically expected to see if i cut the prism in the mid section (150x150mm)?
If i suppose to have a fibres uniform distribution the problem is easy to solve without matlab but i would CONSIDER A FIBRES RANDOM DISTRIBUTION.</p><p>i think have to follow these steps in matlab:
-create the prism
-allocate 1715 point randomly inside the prism (each one for each fibre)
-give shape and volume to the fibres
-give randomly directions to the fibres (the direction should be whichever in the space)
-give 2 constraints: 1) each fibre cannot overlap another one and 2) the fibres cannot go out from the prism
-finally, calculate the number of fibres in the prism midsection</p><p>Somebody can help me?Even a simplify script should be great!
Thanks</p>desperengineeringhttps://uk.mathworks.com/matlabcentral/profile/authors/6182476-desperengineeringtag:uk.mathworks.com,2005:Question/3838102018-02-20T21:33:38Z2018-02-21T17:39:53ZDetermine distance between point from a data table<p>My collaborator sent me a HUGE 200mb table of data as a TXT. I can import it fine, phew.</p><p>Column 6 and 7 are X and Y coordinates.</p><p>I want to figure out the delta/change in distance between row 1 and row 2, row 2 and row 3, etc.
We want to see how far a bird moves each second.</p><p>My attempts are laughably crappy.</p><p>Problem A: Transforming the table data to formats that functions (like "dist") can use, like a matrix or something.
Problem B: Setting up a loop to find the positive distance change for each row and the one below it, then write it to a new array or somesuch.</p>Constance Woodmanhttps://uk.mathworks.com/matlabcentral/profile/authors/10602247-constance-woodmantag:uk.mathworks.com,2005:Question/3836272018-02-20T05:14:41Z2018-02-21T17:38:08ZHOW TO CALCULATE ENTROPY FOR IWT ?<p>hi, I already perform iwt coding. I have "case" command which allows me to choose at which level I want to perform image decomposition for iwt coding. I already calculate the entropy but the resulted value seems wrong. can you check my coding and let me know which part that I'm wrong. The entropy value is decreasing at each level. these are my codings;</p>nur aqilahttps://uk.mathworks.com/matlabcentral/profile/authors/11618331-nur-aqilatag:uk.mathworks.com,2005:Question/3837712018-02-20T18:11:42Z2018-02-21T17:36:10ZHow to iteratively split a matrix into multiple matrices according to a condition?<p>I have a 2 column matrix with many many rows.</p><p>It's been sorted according to the values in the first column.</p><p>I now want to split the matrix into ten matrices.</p><p>Those values in the first column which are 0-10% of the highest value will go in one matrix, those that are 10-20% of the highest value will go in the next... you get the idea.</p><p>How would I go about doing this? I presume a for loop is involved, but am struggling to make it work. Any advice would be very much appreciated - thank you!</p>ishbishhttps://uk.mathworks.com/matlabcentral/profile/authors/11959845-ishbishtag:uk.mathworks.com,2005:Question/3840302018-02-21T17:32:32Z2018-02-21T17:32:32Zhowto extract facial features from a face like forehead length?<p>HI,
i am doing a project on family tracking system through facial feature extraction. i have extracted eyes, mouth,eyebrows and nose. i need to calculate the distance between the facial parts for example difference between left and right eye, eye to nose distance, lips length forehead length etc...
i need help that how can i extract features that can help me in family tracking?
Also tell me about more features...</p>shaista Fazalhttps://uk.mathworks.com/matlabcentral/profile/authors/12210490-shaista-fazaltag:uk.mathworks.com,2005:Question/1271152014-04-25T07:44:01Z2018-02-21T17:28:29ZAdd a comment line into a XML file<p>Hi, I am creating a XML file from scratch as in the following:</p><pre class="language-matlab">% Create the root element
docNode = com.mathworks.xml.XMLUtils.createDocument('Standard:Report');
docRootNode = docNode.getDocumentElement;
</pre><p>I'd like to add a comment line right after the usual XML declaration.
Does anybody know how to do that?
Many thanks in advance.
Regards
Davide</p>Davide Luigi Peregohttps://uk.mathworks.com/matlabcentral/profile/authors/3010464-davide-luigi-peregotag:uk.mathworks.com,2005:Question/3840282018-02-21T17:26:59Z2018-02-21T17:26:59ZColor similarity matrix?<p>I am quite new with MATLAB so my question may sound silly. I have 200 .jpg image files loaded in MATLAB. I would like to create a color similarity/dissimilarity matrix to see how much each image is similar or dissimilar compared with the others. How could I achieve it? Is there any toolbox that is specific for that?</p>Loris Naspihttps://uk.mathworks.com/matlabcentral/profile/authors/10556030-loris-naspitag:uk.mathworks.com,2005:Question/3840272018-02-21T17:22:04Z2018-02-21T17:22:04ZFit a cells with different values.<p>Hi.</p><p>I have a input cell:</p><p>in=
{</p><pre class="language-matlab">[1,1] = 100001
[2,1] = 100000
[3,1] = 100001
[4,1] = 100000
[1,2] =
</pre><pre> 8 9 10 11 12</pre><pre class="language-matlab">[2,2] =
</pre><pre> 13 14 15 16 17 18 19 20 21 22 23 24</pre><pre class="language-matlab">[3,2] =
</pre><pre> 28 29 30 31 32</pre><pre class="language-matlab">[4,2] =
</pre><pre> 61 62 63 64 65 66 67 68 69 70 71 72</pre><pre class="language-matlab">[1,3] =
</pre><pre> 100.00000 19.64800
102.00000 -0.35200
103.00000 27.21000
104.00000 27.19800</pre><pre class="language-matlab">[2,3] =
</pre><pre> 101.000 -30.148</pre><pre class="language-matlab">[3,3] =
</pre><pre> 100.00000 19.64800
102.00000 -0.35200
103.00000 27.21000
104.00000 27.19800</pre><pre class="language-matlab">[4,3] =
</pre><pre> 101.000 -37.489</pre><p>}</p><p>And I need to create output cell with grouped number from in{1:4,1}, and properly in{1:4,3}</p><p>The output should be somethink like:</p><p>out =
{</p><pre class="language-matlab">[1,1] = [100001 100.00000 19.64800 14.50100]
[2,1] = [100001 102.00000 -0.35200 0.49900]
[3,1] = [100001 103.00000 27.21000 24.85300]
[4,1] = [100001 104.00000 19.64800 14.50100]
[1,2] = [100000 101.000 -30.148 -37.489]
}
</pre><p>I need to create a vectors with first element, the 'tittle', so it is 100001 or 10000, the second is a sub-tittle, (100, 101, 102 etc), and rest is a accordingly numeric value. It is understable? :D If not just ask.
I have no idea what i can do it.</p><p>Thanks in advance!</p>Phill Lordhttps://uk.mathworks.com/matlabcentral/profile/authors/6580922-phill-lordtag:uk.mathworks.com,2005:Question/3840262018-02-21T17:20:44Z2018-02-21T17:20:44ZHow to shift 3rd dimension by offset in a 2d matrix efficiently?<p>Hello,</p><p>I have a 3D matrix of size (x,y,z) 5x5x64 and a 2D matrix with offsets of size (x,y) 5x5. I am wondering the most efficient method to circularly shift the individual z-dimensions of the 3D matrix by the amounts in the 2D matrix.</p><p>For example, I have an offset value in the 2D matrix in position (x,y)=(1,1) of 220, and I want to shift the lane (1,1,:) circularly by 220 (front to back); and similarly for all lanes by the given offset value in the 2D table. I would like to do this 'at once' if possible. Any suggestions are appreciated.</p><p>Thanks</p>GeekManhttps://uk.mathworks.com/matlabcentral/profile/authors/12210766-geekmantag:uk.mathworks.com,2005:Question/881372013-09-24T23:21:02Z2018-02-21T17:16:59ZGenerate all possible distributions for nonlinear optimization problem<p>I have set out an optimization problem in hope to find a new distribution for my project. However, the equations are rather complex and I am not sure whether the built-in matlab functions can do the job. So, I want to try simple trial and error by generating all the possible distributions first and then testing it one by one. Can someone help me generate them please?
Max degree : 100;
Possible degrees range from : 0:0.0001:1;
Sum of degrees must be between: 0.9 - 1.1 (ideally 1)</p><p>Initially, I tried to generate them by using permutation with repetition however the size of such a matrix would have (10^4)^100 rows ( set to INF in MATLAB).</p><p>Any suggestions would be much appreciated!</p>Ranahttps://uk.mathworks.com/matlabcentral/profile/authors/4162292-rana