Answered

Error using nargin You can only call nargin/nargout from within a MATLAB function.

nargin cannot be used at the command line, and it cannot be used in a script file or Live Script (except inside a function defin...

Error using nargin You can only call nargin/nargout from within a MATLAB function.

nargin cannot be used at the command line, and it cannot be used in a script file or Live Script (except inside a function defin...

alrededor de 2 horas ago | 0

Answered

Random Colour in Drawformattedtext Function in Matlab

DrawformattedText is part of psychtoolbox but not part of MATLAB. cmap = [0 0 1; %blue 1 1 0; %yellow 1 0...

Random Colour in Drawformattedtext Function in Matlab

DrawformattedText is part of psychtoolbox but not part of MATLAB. cmap = [0 0 1; %blue 1 1 0; %yellow 1 0...

alrededor de 2 horas ago | 0

| accepted

Answered

Finding the mean of a group of images?

bfilter2() is not part of MATLAB, so we do not know what it does. There is a File Exchange contribution https://www.mathworks.co...

Finding the mean of a group of images?

bfilter2() is not part of MATLAB, so we do not know what it does. There is a File Exchange contribution https://www.mathworks.co...

alrededor de 2 horas ago | 1

| accepted

Answered

How to save output(.mat) file for all generated values instead of last values ?

function y = opt(x) Kp = x(1); Ki = x(2); disp(x); filename = 'pqfile.mat'; if ~exist(filename) pqsave.x = []; else...

How to save output(.mat) file for all generated values instead of last values ?

function y = opt(x) Kp = x(1); Ki = x(2); disp(x); filename = 'pqfile.mat'; if ~exist(filename) pqsave.x = []; else...

alrededor de 2 horas ago | 0

Answered

Calling function to evaluate another called function - delimeter error

a = wn(@lk,6,10,5)

Calling function to evaluate another called function - delimeter error

a = wn(@lk,6,10,5)

alrededor de 3 horas ago | 1

| accepted

Answered

Why is 10^(log10(x)) not x?

a = 14.25; a2 = 10^(log10(a)); for K = 1 : 100 a3 = 10^(log10(a+K*eps(a))); if a3 ~= a2; break ;end end fprintf('a...

Why is 10^(log10(x)) not x?

a = 14.25; a2 = 10^(log10(a)); for K = 1 : 100 a3 = 10^(log10(a+K*eps(a))); if a3 ~= a2; break ;end end fprintf('a...

alrededor de 3 horas ago | 1

Answered

How can I get my matrix to populate with correct values from for loop?

xm = (xa + xb) / 2; You do not reset xa and xb to their original values for each j value.

How can I get my matrix to populate with correct values from for loop?

xm = (xa + xb) / 2; You do not reset xa and xb to their original values for each j value.

alrededor de 4 horas ago | 0

Answered

How to remove the unwanted zero at the end in the floating point variable?

And then I want to convert it to binary (only 1.0066 to binary). How can I do that? a=1.006600000000000 bin = int16(a*2^14) r...

How to remove the unwanted zero at the end in the floating point variable?

And then I want to convert it to binary (only 1.0066 to binary). How can I do that? a=1.006600000000000 bin = int16(a*2^14) r...

alrededor de 4 horas ago | 0

Answered

Input signal and arguments in Ode45. Not enough imput arguments

http://www.mathworks.com/help/matlab/math/parameterizing-functions.html

Input signal and arguments in Ode45. Not enough imput arguments

http://www.mathworks.com/help/matlab/math/parameterizing-functions.html

alrededor de 4 horas ago | 0

Answered

How do I erase following data?

x(find(x<28,1):end) = nan ; or x(~cumprod(x>=28)) = nan;

How do I erase following data?

x(find(x<28,1):end) = nan ; or x(~cumprod(x>=28)) = nan;

alrededor de 5 horas ago | 1

| accepted

Answered

Reading in an array using MATLAB Coder

https://www.mathworks.com/matlabcentral/answers/85669-problem-using-emxarray_real_t-from-matlab-coder#answer_95210 Read the d...

Reading in an array using MATLAB Coder

https://www.mathworks.com/matlabcentral/answers/85669-problem-using-emxarray_real_t-from-matlab-coder#answer_95210 Read the d...

alrededor de 5 horas ago | 0

Answered

Problems with plotting/graph

you did a hold on before that, and that would have frozen ylim, so they might be off plot. ylim auto

Problems with plotting/graph

you did a hold on before that, and that would have frozen ylim, so they might be off plot. ylim auto

alrededor de 5 horas ago | 0

Answered

Vertical error bars disappear on logy plot

When you use Yscale log, then: * if *all* of the y coordinates are negative, a warning is given and plotting proceeds as if t...

Vertical error bars disappear on logy plot

When you use Yscale log, then: * if *all* of the y coordinates are negative, a warning is given and plotting proceeds as if t...

alrededor de 6 horas ago | 0

Answered

Alternates of polyval and polyfit?

https://en.wikipedia.org/wiki/Vandermonde_matrix Suppose you had a polynomial of degree 2, y = a2*x^2 + a1*x^1 + a0*x^0, a2, a...

Alternates of polyval and polyfit?

https://en.wikipedia.org/wiki/Vandermonde_matrix Suppose you had a polynomial of degree 2, y = a2*x^2 + a1*x^1 + a0*x^0, a2, a...

alrededor de 7 horas ago | 1

| accepted

Answered

How do I input a matrix into an equation?

http://www.mathworks.com/help/matlab/math/parameterizing-functions.html

How do I input a matrix into an equation?

http://www.mathworks.com/help/matlab/math/parameterizing-functions.html

alrededor de 8 horas ago | 0

Answered

2 Variables and 2 Unknowns Returning Incorrect Results

fprintf('solution is %g \n', solVA2x) The %i format is only for integers.

2 Variables and 2 Unknowns Returning Incorrect Results

fprintf('solution is %g \n', solVA2x) The %i format is only for integers.

alrededor de 8 horas ago | 0

Answered

How do I save multiple .txt files from different folders to one new folder?

filenames = fullfile({fileList.folder}, {filelist.name}); copyfile(filenames, outputPath); This assumes that the source file...

How do I save multiple .txt files from different folders to one new folder?

filenames = fullfile({fileList.folder}, {filelist.name}); copyfile(filenames, outputPath); This assumes that the source file...

alrededor de 8 horas ago | 0

Answered

How to apply sum function for simulating charges around a circle?

I showed the strategy in https://www.mathworks.com/matlabcentral/answers/766426-how-can-i-handle-division-by-zero-inside-the-sym...

How to apply sum function for simulating charges around a circle?

I showed the strategy in https://www.mathworks.com/matlabcentral/answers/766426-how-can-i-handle-division-by-zero-inside-the-sym...

alrededor de 8 horas ago | 0

Answered

Need MATLAB help for assignment

for r = 1:length(R) for b = 1:length(bD) F = (16/3).*(1./bD).*(1./R).^3.*abs(sqrt((1./R).^4-2.*(1./R).^2.*cos(2.*theta)+...

Need MATLAB help for assignment

for r = 1:length(R) for b = 1:length(bD) F = (16/3).*(1./bD).*(1./R).^3.*abs(sqrt((1./R).^4-2.*(1./R).^2.*cos(2.*theta)+...

alrededor de 8 horas ago | 0

Answered

Unpacking and tabulating contents of a cell array

all_numbers = horzcat(vsel{:}); This is the same as all_numbers = [vsel{:}];

Unpacking and tabulating contents of a cell array

all_numbers = horzcat(vsel{:}); This is the same as all_numbers = [vsel{:}];

alrededor de 9 horas ago | 0

| accepted

Answered

Reading data from file

Read one line at a time and sscanf() the line. fid = fopen('datafile.m','r'); x = sscanf(fgetl(fid), '%d'); Remember to fclos...

Reading data from file

Read one line at a time and sscanf() the line. fid = fopen('datafile.m','r'); x = sscanf(fgetl(fid), '%d'); Remember to fclos...

alrededor de 9 horas ago | 1

| accepted

Answered

Unable to Print Graph being Generated in axes.handle4

You posted that you tried saveas(handles.axes4) but you would need [file,filepath] = uiputfile('*.jpg'); if ~ischar(file); r...

Unable to Print Graph being Generated in axes.handle4

You posted that you tried saveas(handles.axes4) but you would need [file,filepath] = uiputfile('*.jpg'); if ~ischar(file); r...

alrededor de 9 horas ago | 0

| accepted

Answered

Undefined function or variable 'chebwin'.

chebwin() needs the Signal Processing Toolbox to be installed and licensed. That is the same toolbox as pwelch, but due to the w...

Undefined function or variable 'chebwin'.

chebwin() needs the Signal Processing Toolbox to be installed and licensed. That is the same toolbox as pwelch, but due to the w...

alrededor de 9 horas ago | 0

| accepted

Answered

How can I change an element in a matrix with the median of itself and its surrounding elements.

https://www.mathworks.com/help/images/ref/medfilt2.html medfilt2() is already part of the Image Processing Toolbox. You can a...

How can I change an element in a matrix with the median of itself and its surrounding elements.

https://www.mathworks.com/help/images/ref/medfilt2.html medfilt2() is already part of the Image Processing Toolbox. You can a...

alrededor de 10 horas ago | 0

Answered

Help with function that uses a while statement to get the next largest prime number

isscalar() is a test to see if size() of the argument is all 1's -- not empty, not 2D, just a single element. isscalar() has n...

Help with function that uses a while statement to get the next largest prime number

isscalar() is a test to see if size() of the argument is all 1's -- not empty, not 2D, just a single element. isscalar() has n...

alrededor de 10 horas ago | 0

Answered

How can i handle division by zero inside the symsum function?

z=symsum((1./((x-k).^2+y.^2)),k,-1,1); That is not worth doing with symsum. It is only 3 terms; just write them out, or use a v...

How can i handle division by zero inside the symsum function?

z=symsum((1./((x-k).^2+y.^2)),k,-1,1); That is not worth doing with symsum. It is only 3 terms; just write them out, or use a v...

alrededor de 10 horas ago | 0

Answered

Replace number if within 2 numbers and smaller than last number.

A = [1 15; 20 36; 37 50] B = [8, 42, 100] Select = @(M,idx) M(idx) PW = @(cond,val1,val2) Select([val1,val2], [cond, ~cond]...

Replace number if within 2 numbers and smaller than last number.

A = [1 15; 20 36; 37 50] B = [8, 42, 100] Select = @(M,idx) M(idx) PW = @(cond,val1,val2) Select([val1,val2], [cond, ~cond]...

alrededor de 11 horas ago | 0

| accepted

Answered

Preserve the order of matrix when doing symbolic matrix multiplication

This is not possible in any released versions. It might be possible in a future version. In all released versions, individual...

Preserve the order of matrix when doing symbolic matrix multiplication

This is not possible in any released versions. It might be possible in a future version. In all released versions, individual...

alrededor de 12 horas ago | 0

| accepted

Answered

2d plot problem

You need to use separate plots (at least for third). The disadvantage is that it becomes more difficult to track relative values...

2d plot problem

You need to use separate plots (at least for third). The disadvantage is that it becomes more difficult to track relative values...

alrededor de 12 horas ago | 0

Answered

Root finder solver for cubic equation

syms M1 gamma theta_degrees tanbeta_degrees eqn = 1 + (gamma - 1)/2 * M1.^2 * tand(theta_degrees).*tanbeta_degrees.^3 + (1-M1.^...

Root finder solver for cubic equation

syms M1 gamma theta_degrees tanbeta_degrees eqn = 1 + (gamma - 1)/2 * M1.^2 * tand(theta_degrees).*tanbeta_degrees.^3 + (1-M1.^...

alrededor de 12 horas ago | 0