Answered
Extract positive numbers from matrix to matrix
P = M(M>0) ; % where M is your matrix

5 years ago | 0

| accepted

Answered
Is there a way to adaptively sample 2-D surfaces ?
z = @(x,y) 3*(1-x).^2.*exp(-(x.^2) - (y+1).^2)- 10*(x/5 - x.^3 - y.^5).*exp(-x.^2-y.^2) - 1/3*exp(-(x+1).^2 - y.^2); m = 100 ;...

5 years ago | 0

Answered
pulling array values using min values from separate array
REad about min function, it also give you the index/ location of the minimum value. A = [1, 4, 7, 10] ; B = [4, 5, 1, 8] ; [...

5 years ago | 0

| accepted

Answered
Derivation of sin(x) gives false cos(x)
t = 0.05; x = 0:0.05:2*pi; y = sin(x); figure(1) plot(x,y,'r') xlabel('time') ylabel('distance') %% vel = gradient(y...

5 years ago | 1

| accepted

Answered
Mathlab loops questıons about new starters
REad about the function input.

5 years ago | 1

Answered
k means clustering using k=4
I = imread('Mandril.jpeg') ; I = im2double(I); R = I(:,:,1); R = R(:); G = I(:,:,2); G = G(:); B = I(:,:,3); B = B(:); idx...

5 years ago | 0

| accepted

Answered
How do I find cluster center of each cluster gained from Spectral Clustering?
As you have indices in hand, you can get the centers.... clear clc load('xi.mat'); K=100; [idx]=spectralcluster(xi, K); C ...

5 years ago | 0

| accepted

Answered
Plot error: index in position 1 is invalid
This line: plot(t,Psi(0,t),'bo--','linewidth',2,'markerfacecolor','b') t is a scalar value first i.e. t = 1.1000e-06; and Psi ...

5 years ago | 0

| accepted

Answered
How to convert RGB gcf to grayscale gcf ?
h = rand(10) heatmap(h) ; colormap(gray)

5 years ago | 0

| accepted

Answered
please help me find the error of my script!
Rename the file name on the name of the function. Rename volume.m to FindTankVolume.m. You can click on the error, press fix. ...

5 years ago | 1

Answered
Undefined function or variable t
It looks like you are running the function striaght away by hitting the run button. No it cannot be done like that. The function...

5 years ago | 0

Answered
change size of images
Read about imresize. Run a loop for each image and change them and save them if you want using imwrite.

5 years ago | 0

| accepted

Answered
How to use "nan"
LEt's say you want to change the values beyond a given value val (a number) into NaN. Use: u(u>val) = NaN ; isnan is afunctio...

5 years ago | 0

Answered
How can i make a colored 2d grid map, using a equation?
You need to proceed something like this: % mesh x = linspace(-1,1) ; y = linspace(-1,1) ; [X,Y] = meshgrid(x,y) ; ...

5 years ago | 0

Answered
Find data in a matrix
[X,Y] = meshgrid(lon,lat); idx = A>0.5 ; % A is your data iwant = [X(idx) Y(idx) A(idx)] ;

5 years ago | 0

| accepted

Answered
Interpolate data in array to match specified length of data in another vector.
m = size(A,1) ; % m = 1267 n = size(B,1) ; % n = 52820 A_new = zeros(n,3) ; xi = (1:n)' ; x = linspace(1,n,m)' ; for...

5 years ago | 0

| accepted

Answered
generate mesh on 2d plot
Read about delaunayTriangulation also have a look on this package https://in.mathworks.com/matlabcentral/fileexchange/25555-mesh...

5 years ago | 0

Answered
Index in position 2 exceeds array bounds
This error occurs when you try to extract more number of elements/ rows/ columns than present in the matrix. Example: A = ran...

5 years ago | 0

Answered
How to find duplicate and missing files of a folder
folders = dir('*') ; N = length(folders) ; filenames = cell([],1) ; n = 0 ; for i = 2:N if isfolder(folders(i).name)...

5 years ago | 0

Answered
need help to reduce time for each loop
You need not to run loop for this. Read about function ismemeber, ismembertol, knnsearch. [lia,lob] = ismember(taxidata.Pickup...

5 years ago | 0

Answered
Can't get plot to work
Save into a Matrix and plot all at once: %Euler's Method h=.25;%step size xinitialcondition=0;%initial condition for x yinit...

5 years ago | 0

Answered
Chained Function in MATLAB
You may proceed something like this: x0 = 1:10 ; n = 10 ; % number of times the function func1 to be called var = rand(n,...

5 years ago | 1

| accepted

Answered
how to run c at intervals [0, 1] with a jump of 0.5
c = 0:0.5:1

5 years ago | 0

Answered
Filling in gaps in plot
Read about fillmissing. Read about imresize, interp2

5 years ago | 0

Answered
How can I remove the whole plot when 1 point of the plot is above a threshold ?
A = rand(10,1) ; % random data idx = A>0.7 ; % indices of values which are greather than 0.7 A(idx) = [] % remove value...

5 years ago | 0

Answered
getting the error in solving non linear equations
You have to show us the full code to get a straight help. Without ocde it gets difficult for people to understand what exactly i...

5 years ago | 0

Answered
Can I upload data created with Image Labelar to Deep Network Designer?
The error says there are no labls in the imagedatastore. Try this while making imagedatastore. imds = imageDatastore(trainImag...

5 years ago | 0

Answered
Obtain x-values from a 3-d plot
You have a variety of ways to achieve this. As of now have a look on knnsearch with (y,z) points as inputs,,, you will get the i...

5 years ago | 0

Answered
How to draw a vector 1x91 double
vec = rand(1,91) ; % dummy data q = 1:length(vec) ; plot(q,vec)

5 years ago | 0

| accepted

Answered
solving non linear equation
syms x1 x2 eqn(1) = (acos((x1-4.8)/x1)*x1*x1 - (x1-4.8)*sqrt(9.6*x1-(4.8)^2))*x2 -15000 == 0; eqn(2)= (acos((x1-9.9)/x1)*x1...

5 years ago | 0

Load more