Answered
How to plot "f(x,y) = x^2 * y^3" and its partial derivative function in matlab?
x = linspace(-1,1) ; y = linspace(-1,1) ; [X,Y] = meshgrid(x,y) ; f = X.^2.*Y.^3 ; dfdx = 2*X.*Y.^3 ; dfdy = 3*X.^2.*Y.^...

5 years ago | 0

| accepted

Answered
How can we generate random points in a cylinder of given height and radius using interpolation ?
Radius = 1. ; % Radius of the cylindrical shell theta = 2*pi ; % Angle of the Cylinder Height = 5. ; ...

5 years ago | 1

Answered
How can i correct this error "Parse error ´(´"
x=A*sin(w*t+fA); y=B*cos(w*t+fB); if fB==0 y=(B/A)*x; elseif fB==pi/2 y=sqrt(B.^2*(1-((x.^2)/A.^2))); elseif fB==p...

5 years ago | 0

| accepted

Answered
Struggling to connect end points of lines within a plot
L = [0 -1; 0 0 ; 0 1 ; 0 2 ] ; R = [0 -1; 2 0 ;1 1 ; 2 2] ; plot(L(:,1),L(:,2),'r') hold on plot(R(:,1),R(:,2),'r') plo...

5 years ago | 0

| accepted

Answered
how to remove or cut off few data points in distance and elevation vector in up and down inorder to work only with the overlapping part ?
Use logical indexing and pick the points/ remove th points which you don't want. EXample: A = rand(1,100) ; A(A<0.5) % pi...

5 years ago | 0

| accepted

Answered
Remove items from 3D Matrix with 2D mask for each timestep
% data A(:,:,1) = [1 2 2 4] ; A(:,:,2) = [5 2 2 3] ; B = [1 2 NaN 1] ; B_mask = r...

5 years ago | 0

| accepted

Answered
netcdf files in a predefined domain
Something like this should work: index_out_edge = ~(((sub_lat(:)<=lat_edge(1) | sub_lat(:)>=lat_edge(2)) && (sub_lon(:)<=lon_e...

5 years ago | 0

Answered
Subtract matrices in an array 'A' with elements from matrix 'B'
iwant = cell(size(A)); for i = 1:length(A) iwant{i} = A{i}-B(i,:) ; end

5 years ago | 0

Answered
setting up a matrix
https://in.mathworks.com/matlabcentral/fileexchange/73840-itruss?s_tid=srchtitle https://in.mathworks.com/matlabcentral/fileex...

5 years ago | 0

Answered
saving a matrix of each loop
You can save them into a cell as shown below. iwant = cell([],1) ; % initilize a cell array; while(fin) % made sep...

5 years ago | 0

| accepted

Answered
Permutation function for distance measure
You can get the distances between each pair using pdist. From this you can make decision. v = [1 2 3]; P = perms(v) d = pd...

5 years ago | 0

Answered
How do I use the values of the vector in the for loop
p = [.1 1. 2. 1.25 .35]; P = zeros(length(p)) ; for i = 1: length (p) for j = 1: length (p) P (i, j) = p(i) * p(j); ...

5 years ago | 0

Answered
How can i change a cell to an array?
C{1} = rand(2,2,2) ; C{2} = rand(2,2,2) ; C{3} = rand(2,2,2) ; C{4} = rand(2,2,2) ; A = cat(4,C{:}) ; C{1} A(:,:,:,1)...

5 years ago | 0

| accepted

Answered
How to remove unwanted points in point cloud
You can see that the unwanted points are lying in certain intervel of (x,y,z). Get those indices using logical indexing and remo...

5 years ago | 1

| accepted

Answered
what code could possibly solve this problem?
You need to put a closed bracket at the end ')' in the last term. yy.data(:,4) * (yy.data(:,4)) But I suspect, there will be ...

5 years ago | 0

| accepted

Answered
How do I fill 3D planes with a pattern?
Have a look on this. https://in.mathworks.com/matlabcentral/fileexchange/2075-hatch-m

5 years ago | 0

Answered
Slow for loop string comparison
Obviously what you have shown will be dead slow and also may not work. You can striaght aways use strcmp, contains. Read about...

5 years ago | 0

Answered
How can I get operating the code vector computing with different size matrix
Read about logical indexing. Pick the points or x which are not zeros and do the operations on only those points ignoring the po...

5 years ago | 1

| accepted

Answered
How to remove NaNs from an array between points
Read about isnan. idx = isnan(example); idr = diff(find([1;diff(idx);1])); D = mat2cell(example,idr(:),size(example,2)); cel...

5 years ago | 0

| accepted

Answered
Lagrange Interpolation Code Error/Help
You can evaluate polyval using: deg = length(p)-1 ; % degree of he polynomial % get powers of x till deg X = xs'.^(deg:-1:0...

5 years ago | 1

| accepted

Answered
Find how many times a line of code is run
count = 0 ; for j = 1:2:8 count = count+1 ; calcA = calcA+x ; end Check the value of count, it should have run ...

5 years ago | 0

| accepted

Answered
One dimensional interpolation of a two dimensional matrix
Let A be your 24*365 data matrix. t = (60:60:24*60)' ; ti = (1:1:24*60)' ; B = zeros(1440,365) ; for i = 1:365 B(:,i)...

5 years ago | 0

| accepted

Answered
how to use two while and for loops?
if x < 1 statement1 elseif x >= 1 statement2 end

5 years ago | 0

Answered
join 2 strings together to 1
Read about join, strcat. You can also achieve the same using: str = ['Biegung_35_' ,'Evaluation.txt'] ;

5 years ago | 0

Answered
Check for missing argument or incorrect argument data type in call to function 'solve'.
syms x1 x2 x3 x4 eqn{1} = 4.4*x1-2.5*x2+19.2*x3-10.8*x4-4.3==0 ; eqn{2} = 5.5*x1-9.3*x2-14.2*x3+13.2*x4-6.8==0 ; eqn{3} = 7.1...

5 years ago | 1

Answered
roots of non linear periodic function
syms x p = pi/4 ; L = 2 ; eqn = x*L*tan(x*L)-p==0 ; s = vpasolve(eqn,x)

5 years ago | 0

Answered
12 x 12 matrix
A = rand(12) ; B = A(2:10,2:9)

5 years ago | 0

| accepted

Answered
Plotting Multiple Functions on the same graph
z = 0:0.001:1; figure hold on for n = 1:5:15 ysin = fsin(z,n); plot(z,ysin) end grid xlabel('z'),ylabel('sin fun...

5 years ago | 1

| accepted

Answered
Nested For Loop Value Appended to Overall Matrix
lim = 12; count = 0 ; A = zeros([],5) ; for a = 0:lim for b = 0:(lim - a) for c = 0:(lim - a - b) ...

5 years ago | 0

Load more