[Solved] MATLAB: Undefined function for input arguments [closed]
You should have setArray defined- methods function setArray(h) %% code end end solved MATLAB: Undefined function for input arguments [closed]
You should have setArray defined- methods function setArray(h) %% code end end solved MATLAB: Undefined function for input arguments [closed]
The error message give you a big hint where to look: Undefined operator ‘+’ for input arguments of type ‘cell’. Error in gbp2/pts (line 36) ylist(z) = ylist(z) + arrayfun(@(coor) u(z, coor, mode, w, R, Psi),xlist(z).’,’uniformoutput’,false); From the documentation for arrayfun and the ‘UniformOutput’ option: Requests that the arrayfun function combine the outputs into cell … Read more
The optimization algorithm that I was using was GA(Genetic Algorithm). I wrote this function in order to get what I wanted: function [zz,fvalzz] = secstep(z,NVARS) [zz,fvalzz]=ga(@secfun,NVARS); function ff = secfun(zz) y=.5*exp(-35*10^12*(t-2e-6).^2).*cos(2*pi*5e6*(t-2e-6)+0); sigme2=zz(1)* exp(-z(1)*10^12*(t-zz(2)*10^-6).^2).*cos(2*pi*z(3)*10^6*(t-zz(2)*10^-6)+z(4)); %z vector has been calculated from another function. NN=length(y); ff =sum((y-sigme2).^2)/NN; end end solved Reading output of a function as an input … Read more
If the diameter of the area of is not more than a few kilometers (or miles if you insist) then 1) transform the coordinates to x,y space with unit meters 2) Use the simple formula areaint for 1): convert lat and long which are in unit degrees to meters, by multiplying with a factor f … Read more
color_img = imread(‘0k4Kh.jpg’); img = rgb2gray(color_img); [x, y] = size(img); for i = 1:x if length(find(img(i, :))) ~= 0 lastmarginalrow = i-1; break; end end for ii = y:-1:1 if length(find(img(:, ii))) ~= 0 lastmarginalcol = ii-1; break; end end figure; fig = imshow(color_img); h = impoly(gca, [0,x; lastmarginalcol,x; lastmarginalcol,lastmarginalrow; 0,lastmarginalrow]); api = iptgetapi(h); api.setColor(‘red’); … Read more
Here’s a list of what I see wrong: deep breath The indexing syntax (:1) is incorrect. Perhaps you mean (:,1) as in “all rows of column 1”. There is no such thing as a do…while loop in MATLAB. Only FOR and WHILE loops. Also, your for loop is defined wrong. MATLAB has a different syntax … Read more
You can define the matrix like so (semicolons can be used for line breaks) A = [1 2 3; 4 5 6; 7 8 0] A = 1 2 3 4 5 6 7 8 0 Then you calculate the determinate by using DET det(A) ans = 27 8 solved MATLAB: how to calculate the … Read more
found the answer myself.. note that there is a difference between sinx and sin(x) function [sinx, error] = sinx_approx(x) % approximates the value of sin(x), the approximation is more accurate as % the number of terms selected is increased. n= input(‘Up to how many terms would you like to evaluate?’); sinx=0; for i=1:1:n sinx=(-1)^(i+1) * … Read more
The total number of pixels is not equal to the sum of values in your image. sumOfAllPixelValues = sum(double(rgbImage(:))); numberOfPixels = numel(rgbImage); The size on disk of an image is numberOfPixels*bytesPerPixel, where bytesPerPixel depends on the bit depth of an image (uint8 would be 8 bits=1 byte, for example. To downsample the image by half, … Read more
For each set of two columns, you can use sortrows. for idx=1:2:size(M,2) M(:,idx:idx+1)=sortrows(M(:,idx:idx+1),2) end 2 solved Matlab sort every other column
The Systems Identification Toolbox may have what you need. If you need or want to do it by hand, however (homework?), I would suggest outlining the steps of what needs to be done (break up the problem in parts, starting from the definition of MA models) and asking a more detailed question when you get … Read more
It’s not possible to do imagesc and axis off at the same time. However, you can modify the imagesc code to achieve this but you will not get MathWorks support for the modified version. To avoid the graphical artifacts, try different figure renderers: painters, opengl, … You can also try the startup flag -softwareopengl. solved … Read more
I’m assuming that A and B are coordinates, and you want to “draw” the plot in matrix form, so try this: c = flipud(full(sparse(B, A, B))); I added flipud to adjust the positive direction of the y-axis upwards. Alternatively, you can obtain a binary matrix using this: c1 = flipud(full(sparse(B, A, ones(size(A))))); Important: for this … Read more
make some arrays of data: n=100 v1=rand(n,1); v2=rand(n,1); v3=rand(n,1); make a linear combination of the data Y=2*v1+3*v2+5*v3; make a noisy matrix out of the data: X=[v1 v2 v3]; X=X+rand(size(X))/10; run the function beta=lars(X, Y) beta should be [2,3,5] solved can anyone suggest to me LARS algorithm code? [closed]
The problem can be expressed as finding the 3-by-3 matrix M such that the coordinates of a point P can be converted between the old coordinate system (P_old, 3 rows) and the new coordinate system (P_new, 3 rows). This is an affine transformation: P_old = Center + M * P_new (1) The (matrix-vector) multiplication with … Read more