Answered
Creating a profile of 2D array
I hope you have X, Y, Z matrices of size specified. And you want to know the value at given point (x,y). IN that case you need t...

6 years ago | 0

Answered
Making consecutive 1s and 0s as a seperate element
Refer this link: https://in.mathworks.com/matlabcentral/answers/104614-grouping-continuous-nonzero-in-a-row-vector

6 years ago | 0

Answered
How to find x-values when y-function equals a set value?
You can take your curve as L1 and define your straight line at y = 0.7 as curve L1 and use InterX. Get the function InterX from:...

6 years ago | 0

Answered
creat matrix with specific row element
iwant = zeros(100) ; iwant(:,1:2:end) = 2 ;

6 years ago | 0

Answered
Exporting a code from Maple to Matlab
Some thing like this: x = linspace(0,1) ; t = linspace(0,1) ; [x,t] = meshgrid(x,t) ; u =1./(1. + exp(x)).^2 + 1./(1. + e...

6 years ago | 0

Answered
Storing a surface slice in a .mat file and plotting the stored slice
You save all the slices into a cell and save them into .mat file. S = cell(N,1) ; S{1} = slice(X,Y,Z,vol,X_1,Y_1,Z_1,'linear...

6 years ago | 0

Answered
Contour plot size reduction
Use this: https://in.mathworks.com/matlabcentral/fileexchange/23629-export_fig for exporting images for better quiality.

6 years ago | 0

Answered
Converting Frequency domain to time domain
data = csvread(myfile.csv) ; % also have a look on readtable, xlsread a = data(:,1) ; % acceleration f = data(:,2) ; % fr...

6 years ago | 0

Answered
How can I fix "Index exceeds the number of array elements (1)."
Modify it to: function [ca, depth] = transientDiffModel(B,Ds,H,ct,dz,t,th) B= input(' B:degradation rate of antibiotic in biof...

6 years ago | 1

Answered
Filling in 8x8 matrix with formula
A = zeros(8,8) for i = 1:8 p = (pi/16)+(i-1)*(pi/8) for j = 1:8 A(i,j) = cos((j-1)*p) end end ...

6 years ago | 1

| accepted

Answered
How to split data into multiple "chunks"?
Read about reshape. A = rand(1,1000) ; n = 100 ; iwant = reshape(A,100,[]) ; size(iwant) iwant(:,1) % 10 columns of 10...

6 years ago | 1

Answered
trying to output mean values that were calculated into excel.
May be you want to find the mean for every four elements and get 10 means. See the below: A = rand(1,40) ; % random data for ...

6 years ago | 0

Answered
avoiding nested for loops for matrix assignment
m = 10000 ; n = 10000 ; [i,j] = meshgrid(1:n,1:m) ; a = i+j ;

6 years ago | 0

| accepted

Answered
Obtaining the values within the boundary of my map
Something like this: [m,n,p] = size(EWT) ; [X,Y] = meshgrid(lambda-180,phi) ; B_1 = shaperead('Aqueduct_river_basins_TIGRIS...

6 years ago | 0

| accepted

Answered
Set variable = 0 and run while loop
We can help you in specific if you show us the code. As of now, you can save the variables inside the loop into an array and p...

6 years ago | 0

Answered
Nested If Statement HELP
prompt = ' enter a value between 0 and 100 ' ; x = input(prompt) ; if x >= 90 && x <= 100 disp (' Grade is A '); else...

6 years ago | 0

Answered
Display the Vertex and Triangle labels on a meshes plot
x = rand (10,1); y = rand (10,1); tri = delaunay (x, y); triplot (tri, x, y); hold on; plot (x, y, "r*"); nodes = [1...

6 years ago | 1

| accepted

Answered
How can I fix "error Using plot" "Data cannot have more than two dimensions"?
Your V2 is a 3D array..it is of size 1*1*91.....Use: plot(Hp,squeeze(v2),'-b') Check your code where V2 is generated and try t...

6 years ago | 2

Answered
Index exceeds the number of array elements (1)
Your file nums2.txt has alternate lines of data..every alterate line is a empty line, when you try to read using the file using ...

6 years ago | 0

| accepted

Answered
how to plot quadratic equation with 2 variable
x = linspace(0,1) ; y = linspace(0,1) ; [X,Y] = meshgrid(x,y) ; f = 1/2*X.^2 + X.*Y + Y.^2 + Y ; surf(X,Y,f)

6 years ago | 0

Answered
Unequal vectors in one matrix.
C1=[1 1 1 1 2 2 2 2 1 1]; C2=[0 0 0 0 3 3 3 3 ]; C3=[4 4 4 4 5 5 5 5 6 75 5]; C4=[6 5 6 6 7 7 7 7]; iwant = NaN(4,11) ; i...

6 years ago | 0

Answered
Newton Raphson method help
fun = @(x) x^3 + 2*x^2 - 2; dfun = @(x) 3*x^2 + 4*x ; function [x1,n] = newton(fun,dfun,x0,tol) n = 0; x0 = rand ; % in...

6 years ago | 1

| accepted

Answered
hey i need your help!!
It can be done both by writitng your own code or using inbuilt functions.... You canget analytical solution using syms, dsolve....

6 years ago | 0

| accepted

Answered
How do I express coefficient x, y, z using a, b, c, P0?
syms VLED ILED P0 w t x y z a b c VLED = a*log(ILED)+b*ILED+c ; ILED = P0*sin(w*t)^2/VLED ; ILED = sqrt(x*sin(w*t)^2+y)-z ...

6 years ago | 0

Answered
How to make color magnitude by quiver plot?
You can use some fileexchange functions: https://in.mathworks.com/matlabcentral/fileexchange/3225-quiverc https://in.mathwor...

6 years ago | 0

Answered
My matlab function is only returning one output
You have to define your input and call the function in the workspace as shown below. x = rand(1,100) ; [ sd, mea, mod, va, me...

6 years ago | 0

Answered
How to make a heat map using three variables?
c_1 = 0.5; R = 10^(-3); N = 100; theta = linspace(0,pi/2,N); r = linspace(0,R,N); [r,theta] = meshgrid(...

6 years ago | 0

| accepted

Answered
Writing a find function
You can proceed something like htis: score = randperm(100,1) if score >=90 grade = 'A' ; elseif (score >= 80) & (sc...

6 years ago | 0

Answered
Plotting multiple polygons using lines
figure hold on patch(X1(1:8),Y1(1:8),'y','EdgeColor','k') patch(X1(10:end),Y1(10:end),'y','EdgeColor','k')

6 years ago | 0

| accepted

Answered
How to use fmincon in GNU Octave?
You can implement fmincon in OCtave too....read it here: https://octave.sourceforge.io/optim/function/fmincon.html

6 years ago | 1

Load more