Answered
Different number of for loops
x1 = 0:9 ; x2 = 0:5 ; x3 = 0:5 ; x4 = 0:5 ; [x1,x2,x3,x4] = ndgrid(x1,x2,x3,x4) ; thesum = x1+x2+x3+x4 ; idx = thesum ...

6 years ago | 0

Answered
Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'.
Read about element by element operations. Example: x = rand(1,10) ; x^2 % throws error x.^2 % this is what you have...

6 years ago | 0

Answered
How to change the name of the images from frame1.jpg , frame2. jpg to image1.jpg etc etc
Refer here: https://in.mathworks.com/matlabcentral/answers/338822-rename-files-using-matlab To read the files in order use: ht...

6 years ago | 0

Answered
Struct vs Table - which is better
Table is better when compared to structure. You go ahead with table. https://in.mathworks.com/matlabcentral/answers/425114-wha...

6 years ago | 0

Answered
Points inside multiple polygon for contour
Read about inpolygon. If you have a polygon and a set of points, you cann extract the points lying inside this polygon using tha...

6 years ago | 0

| accepted

Answered
help with cubic spline interpolation
y=[373,484,635,798,975,1085,1104,996,841,682,523,394,373]; x=[1,32,59,90,120,151,181,212,243,273,304,334,364]; yi = spline(x...

6 years ago | 0

Answered
Help me to solve the function
clear; clc; wc=0.4; pc=3.16; T=293; rwc3s=0.586; rwc3a=0.172; ...

6 years ago | 0

| accepted

Answered
How can I shade or hatch regions bounded by contour lines, to distinguish feasibility zones from constraint zones in a contour plot?
You can use some file exchange functions. https://in.mathworks.com/matlabcentral/fileexchange/2075-hatch-m Also you can fill...

6 years ago | 0

Answered
how do I fix this code
You should not run the function by hitting the run button...you should define the input variables and then call the function. ...

6 years ago | 0

Answered
Error using plot3 Vectors must be the same length.
Read about element by element operations. t = linspace(-100*pi, 100*pi); %define the range you are plotting over x = (t-2)....

6 years ago | 0

Answered
How to animate a cosine plot using getframe
t=0:pi/100:10; tlength = numel(t); for i=1:tlength plot(cos(1:t(i))); F(:,i) = getframe; end movie(F); Also read...

6 years ago | 1

| accepted

Answered
how to color the world with two color(red and green)?
Refer this link: https://in.mathworks.com/matlabcentral/answers/598378-how-to-plot-coast-and-fill-the-land-with-gray-without-m_m...

6 years ago | 0

Answered
Finding the indices of the maximum of a matrix for plotting
load('x.mat') load('y.mat') load('m.mat') [X,Y] = meshgrid(x,y) ; Z = m ; % Make Z equal to size of X, Y Z(1,:) = []; ...

6 years ago | 1

| accepted

Answered
convert 262144x1 into 1x262144.
If A is your array..just transpose it. iwant = A' Read about transpose.

6 years ago | 0

| accepted

Answered
Surf(x, y, z) with a colormap that is only two colours
You can try something like this x = linspace(-20,20,2400); fz = exp(-x.^2./0.2).*cos(5.*x); [X, Y] = meshgrid(x, x); z = exp...

6 years ago | 0

Answered
I keep getting input error
You have to use Ohm's law instead of the unknown variable current. Use fprintf instead disp. %r is r1 33 r2 47 = 80 % xl1 i...

6 years ago | 0

Answered
How to add an extra for loop
newTime = cell(1,4); % cell because, we are not sure of dimensions in each case R = [7 11 ; 56 59 ; 99 106 ; 133 143 ] ; % ...

6 years ago | 0

| accepted

Answered
Tidal Harmonic analysis, by finding the amplitude and the phase of each tidal component
Refer these file exchange packages. https://www.eoas.ubc.ca/~rich/ https://in.mathworks.com/matlabcentral/fileexchange/46523...

6 years ago | 0

| accepted

Answered
convert 128x2 char to 1x64 char
If val is your char array..you can try something like: iwant = strcat(val(1:2:end),val(2:2:end))

6 years ago | 0

| accepted

Answered
how sum all element which are the right of diagonal. where row=colom .....i have done this much but confuse in further operation
Read about triu. https://in.mathworks.com/help/matlab/ref/triu.html If A is your matrix, use: iwant = sum(sum(triu(A)))

6 years ago | 0

Answered
Plotting coordinate points using plot()
rng (7) n = 30; center = [0 0]; radius = 1; eps = 0.1; r = eps*rand(n,1) + radius -eps/2; A = [center(1) + r.*cos(2*pi*(1:...

6 years ago | 1

Answered
Unable to perform assignment because the size of the left side is 1-by-7056 and the size of the right side is 1-by-213444
The error is clear..you have initiliazed a array with smaller dimension and you are trying to save more elements in the array. ...

6 years ago | 0

| accepted

Answered
How to make a list of appearance
Let str be your list of animals. xbins = unique(str); [counts,centres] = hist(str,xbins); R = [centres counts']

6 years ago | 0

Answered
How to add all the curves in a single figure?
figure(4) hold on plot(Out(:,1),time); plot(Out(:,10),time); plot(Out(:,20),time); set(gca, 'ydir', 'reverse'); xlabel('Rp...

6 years ago | 0

| accepted

Answered
Implementation of formula in a single line.
x = linspace(-4,+4,100) ; z = x ; L = 2 ; A = 1.6732; z(x<0) = L*A*exp(x(x<0)-1) ; plot(x,z)

6 years ago | 0

Answered
3d plot with different length of x and y
surf, pcolor is your function. You can plot using that. x = 1:21 ; y = 1:101 ; Z = rand(21,101) ; [X,Y] = meshgrid(x,y...

6 years ago | 2

Answered
How to connect two displays?
clc;clear C1 = input('Please enter a code to break: ' , 's'); if length(C1) ~= 6 disp('Decoy message: Not a six-digit num...

6 years ago | 0

| accepted

Answered
How do I add a colormap to a series of 3D lines?
Read about waterfall.

6 years ago | 0

Answered
Increment change For loop
val = [1:2:19,23:4:200] ; N = length(val) ; iwant = zeros(1,N) ; for i = 1:N iwant(i) = val(i) % In case you want to...

6 years ago | 1

Answered
find row in specifics value
[val,idx] = max(hasildk,[],2)

6 years ago | 0

| accepted

Load more