Answered
Create a matrix with multiple values at each element and apply a function to all?
Here is one way: [XXs,YYs] = meshgrid(Xs,Ys); fxy = f(XXs,YYs);

6 years ago | 1

Answered
confronting cell with abelians (logic values)
Here is one way: C = A; C(~B) = {'0'};

6 years ago | 0

| accepted

Answered
plot a function having two variables with unequal elements
Merging the code you've provided with Walter's comments: pitch=[30 40 50 60 70]' ; L=linspace(1,1000); delta1 = 1; W1 = 1;...

6 years ago | 0

Answered
The code behind rectangular command
It's doing what is described in the documentation for the rectangle function. Hint: There is a line function in MATLAB.

6 years ago | 0

Answered
calculating the mean of specific array using previous & next array
The variable outliers contains the indices to the outlier locations, right? Then W(outliers) = (W(outliers-1) + W(outliers+1))/...

6 years ago | 0

| accepted

Answered
I keep on getting this error when I try to turn my given data into a graph
A=importdata('mariana_depth.csv'); lon=importdata('mariana_longitude.csv'); lat=importdata('mariana_latitude.csv'); [lat_...

6 years ago | 0

| accepted

Answered
I keep on getting this error when I try to turn my given data into a graph
I can guess at a couple problems here, and I'm also going to guess that you didn't really study the documentation for surfc, to ...

6 years ago | 0

Answered
Sort a matrix based on unique values
I think you can use the ismember function to do what you want. For example, [tf,loc] = ismember([1001 1002 1004],[1001 1002 100...

6 years ago | 1

| accepted

Answered
How can I improve the performance of my code? Specifically with the randn function for large arrays in a Monte Carlo simulation.
I did not try to run your code, but did some independent testing. I ran in chunks of 1e6, which seemed empirically seemed about...

6 years ago | 1

| accepted

Answered
How to located a point on top, in between and below two curves.
You should be able to use the inpolygon function to solve this.

6 years ago | 1

| accepted

Answered
Error in using rmoutliers()
Running this load FORCHECK.mat FFF = rmoutliers(FORCHECK,'percentiles',[0 90]); worked just fine for me. Maybe just restar...

6 years ago | 1

Answered
Creating a matrix from spaced out lines of another matrix
Here is a function definition. Put it in a file named smallFromBig.m. function [xyzSmall] = smallFromBig(x,y,xyzBig) ...

6 years ago | 0

| accepted

Answered
How to obtain eigenvalues as functions of a variable?
Take a look at John D'Errico's eigenshuffle function in the File Exchange. I believe it does what you want (and there is some th...

6 years ago | 0

| accepted

Answered
Plotting a function with two terms or alternatively a curve of best fit to a histogram
If you have all of the x values, then you should be able to fit using the fitgmdist function, which will find the best fit to mu...

6 years ago | 1

Answered
Converting input matrix A with size 4x3 into B matrix with size 12x3 with coordinates in matrix A
Here is a somewhat slick way: [m,n] = size(A); AA = A'; B = [repelem(1:m,n)' mod(0:m*n-1,n)'+1 AA(:)]; This is fine if one...

6 years ago | 0

Answered
Converting input matrix A with size 4x3 into B matrix with size 12x3 with coordinates in matrix A
There are some slicker ways to do this, but it might be instructive for you to see how to do this with a simple for loop: [m,n]...

6 years ago | 0

| accepted

Answered
determining linear independence among two vectors using least square method
If you have the Statistics and Machine Learning Toolbox, then you can use the fitlm function.

6 years ago | 0

Answered
determining linear independence among two vectors using least square method
If your two vectors are v1 and v2, then you could use the corrcoef function to calculate the correlation coefficient and its p-v...

6 years ago | 0

Answered
Find indexes according to a value in array
Dare I say obviously, A can't obey both the conditions simultaneously. You need to find the indices separately. [find(A<=x,1,'l...

6 years ago | 0

| accepted

Answered
error while using Operands
Here's what is means: true && true; % This works, and gives a scalar result [true true] && [true false]; % This gives the er...

6 years ago | 0

Answered
How to correct matrix dimension disagree error
You are effectively trying to do this operation in your code: n * u where n is a 1x4 matrix, and u is a 1x100 matrix. That wo...

6 years ago | 0

Answered
Select specific cells from a cell array and create a seperate vector
Does your cell array have only numeric values in it? If yes, then maxVal = max(cell2num(C),[],3) where C is your cell array.

6 years ago | 0

| accepted

Answered
How to create a plot of the spread of the data
Does using subplots help show your point better? % Load the data load Data1.mat % Convert from table to numeric Data = tab...

6 years ago | 0

| accepted

Solved


Say something funny
Say something funny, or not. Your solution will be (fully automatically and objectively) scored based on how clever or funny ...

6 years ago

Answered
set default line marker symbol
See this answer from Mathworks support.

6 years ago | 1

| accepted

Answered
how to find the Reverse process of A(B).
C = [9 4 2 1 7 6 8 5 3 8 11]; A(B) = C

6 years ago | 1

Answered
How do I find the column of maximum values of a maxtrix?
Here is one way to do it. [~,linearIndex] = max(x,[],'all','linear'); % First, find the *linear* index of x [rowIndex,colIndex...

6 years ago | 0

Answered
Area of an closed 2d plot
The polyarea function.

6 years ago | 0

Answered
How can I do polynomial fitting when X-axis is time
Hm. Plotting the data you posted, using the seconds function, results in exactly what I would expect -- including capturing the ...

6 years ago | 0

Answered
Get the diagonal without calculating the explicit matrix
Here is one way: % Make up some inputs N = 4; B = rand(N); C = rand(N); % Calculate the diagonal A_diag = 0; for nr = 1...

6 years ago | 1

Load more