Answered
Modified contour plot with different functions
[X,Y,Z] = peaks(100) ; % let this be g idx = Z>3 & Z<5 ; % a given condition contour(X,Y,Z) hold on plot(X(idx)...

7 years ago | 1

| accepted

Answered
Color map plotting with weightage
Read about scatter [num,txt,raw] = xlsread('Book1.xlsx') ; x = num(:,1) ; y = num(:,2) ; w = num(:,3) ; plot(x,y...

7 years ago | 0

| accepted

Answered
How can I find the average of certain rows in a column depending on the value of another column?
A = [1 1 2 1 3 2 4 2 5 1]; [c,ia,ib] = unique(A(:,2)) ; iwant = zeros(length(c),1) ; for i = 1:length(...

7 years ago | 0

Answered
How can I get the maximum difference in the specific range?
Let t, data be your time and data. You have two options: First option % Remove the specified data, this will reduce the lengt...

7 years ago | 0

| accepted

Answered
equation fof streamline in flui mechanics
[x,y] = meshgrid(0:0.1:1,0:0.1:1); k = 1 ; u = k*x; v = -k*y; figure quiver(x,y,u,v) startx = 0.1:0.1:1; starty = on...

7 years ago | 0

Answered
keep getting 1X4 syms as my answer instead of a value
Read about double. Convert your sym to double. C_n = double(C_n)

7 years ago | 0

Answered
how to plot such a graph in matlab?
THat index you should include on the plot...read about text to diaply such text you want on the plot.

7 years ago | 0

| accepted

Answered
Making video from an animation
YOur writevideo command is out side the loop..this should be inside the loop.

7 years ago | 0

| accepted

Answered
Change brightness of png image
I = imread('peppers.png') ; I1 = I+50 ; figure(1) ; imshow(I) ; figure(2) ; imshow(I1) ;

7 years ago | 1

Answered
what does x= [ones(1,2) 2 ones(1,1) 2 ones(1,2) 1] do?
It depends on the requirement of what array you want. If you see that line generates: [1 1 2 1 2 1 1 ...

7 years ago | 0

| accepted

Answered
could anyone help me to solve the following issue.
for iteration=1:iterations %iterations=3; if i == 1 centroids = 3 ; else centroids = 6 ; end ...

7 years ago | 0

Answered
i need to subtract two arrays of different sizes
C = A-B'

7 years ago | 1

Answered
How can i use 'sum' for a 'cell array'?
A = cell(4,2) ; for i = 1:4 for j = 1:2 A{i,j} = rand(1,2) ; end end B = cellfun(@sum,A)

7 years ago | 0

| accepted

Answered
check the data is number or not?
a = rand(3) ; isnumeric(a)

7 years ago | 0

Answered
how to preallocate a figure handle?
h = gobjects(1,10) ; for i = 1:10 h(i) = plot(rand(1,10)) ; end Read here: https://in.mathworks.com/help/matlab/creati...

7 years ago | 1

| accepted

Answered
How to erase cell array element with less than three characters
C = [{'cgu'} {'gca'} {'guc'} {'a'}] ; L = cellfun(@length,C) ; % GEt length of each cell array C(L<3) = [] % R...

7 years ago | 0

| accepted

Answered
How can i find the all the positions of elements in cell and record them all in an the same cell
fid = fopen('data.txt','rt') ; S = textscan(fid,'%s','delimiter','\n') ; S = S{1} ; fclose(fid) ; S = strsplit(S{1})' ; ...

7 years ago | 0

Answered
How to save continuous position values in an image?
I = imread('testimage_paint.bmp'); I = rgb2gray(I) ; [y,x] = find(I) ; % Arrange the ppoints in order P = [x y]; % coordi...

7 years ago | 0

| accepted

Answered
FFT on data acquired from an accelerometer?
L = length(time_vect) ; % signal length n = 2^nextpow2(L); M_vect1_FFT = fft(M_vect1-mean(M_vect1),n); f = f*(0:...

7 years ago | 2

Answered
How to cluster pixels within a particular region using k-means?
I = imread('image 2.jpg') ; [y,x] = find(I) ; idx = I>0 ; z = I(idx) ; % Use kmeans G = 3 ; % number of groups idx =...

7 years ago | 0

| accepted

Answered
Array indices must be positive integers or logical values.
Note that the index of array cannot be zero, negative and fraction...so the error. %t = linspace(0,2,100); t= (0:0.05:2); V=...

7 years ago | 1

Answered
how to change multiple items in a text file?
fid = fopen('data.txt','r') ; S = textscan(fid,'%s','delimiter','\n') ; fclose(fid) ; S = S{1} ; % Get indices Tsteps i...

7 years ago | 0

Answered
Computational time of qr, svd and eig?
%% Computational time for qr. clear all; clc; close all; m = 700; n = 500; N = 100 ; t11 = zeros(N,1) ; t21 = zeros(N,1)...

7 years ago | 0

Answered
How to generate a circle within a digital image?
I = imread('peppers.png') ; [nx,ny,nz] = size(I) ; C = [round(ny/2) round(nx/2)] ; % center of circle R = 100 ; % Radius...

7 years ago | 0

| accepted

Answered
How do I iterate through columns to find specific values?
Let A be your matrix. idx = A>=200 & A<=255 ; % this gives logical indices A(idx) % this gives all numbrs

7 years ago | 0

Answered
How can I plot data in one matrix and color the data differently using data from another matrix?
data =[1 2; 2 4 ; 3 6;4 7]; R= [0 1 0; 0 0 1; 0 1 0; 1 0 0]; figure hold on for i = 1:size(data,1) plot(data(i,1),dat...

7 years ago | 0

Answered
Extrapolating dataset and find intersection
You should be having coordinates of the lines: use this: https://in.mathworks.com/matlabcentral/fileexchange/35606-line-line-i...

7 years ago | 0

| accepted

Answered
Fitting logarithmic curve in a 3d plot between X Y and Z
Read here: https://in.mathworks.com/help/curvefit/fit.html

7 years ago | 0

Answered
how do you ask matlab for a random word from dictionary?
idx=randperm(length(dictionary),1); randword = dictionary{idx}

7 years ago | 1

| accepted

Answered
How can I save nested for loop results as a matrix?
With Loop p=50; L=3; E = 1.75*10^6 ; %lbf/in^2 I = 175 ; %in^4 eq1 = @(b,x) -((p.*b*x)./(6*L*E*I)).*(L^2 -b.^2 - x^...

7 years ago | 0

Load more