Answered
Substract two elements in an array
iwant = X(end)-X(1)

4 years ago | 0

| accepted

Answered
How can I integrate experimental data using a for loop?
You need not to use a loop. Read about trapz.

4 years ago | 0

Answered
How can I automate the fplot of a polynomial as a function of its degree?
Why you want to use fplot? You can striaght away use polyval. load=[0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0];%measured data ...

4 years ago | 2

| accepted

Answered
Change the width of the plot
Replace this line: plot(ax2,x,y3, 'k') with plot(ax2,x,y3, 'k','LineWidth',5)

4 years ago | 0

| accepted

Answered
Why the answer is 10.
If you want 11 use ceil. y = (3.8 - 1.6)/0.2; x = ceil(y); disp(x); Alos have a look on functions round, fix.

4 years ago | 0

Answered
Find out the minimum value from a column
Read about the function min. A = rand(3,10) ; iwant = min(A) % this is same as min(A,[],1)

4 years ago | 0

| accepted

Answered
expected value of matrix
a = [ 0.0994 0.3661 -0.2125 0.2839] ; E = a'*a

4 years ago | 0

Answered
Neural Network hyperparameter tuning
You have straight away extended the single input method to two inputs method and messed with the dimensions. You need to check t...

4 years ago | 0

| accepted

Answered
How to change positive/ negative sign of a value in if condition loop ?
Why you are worried about creating it in a loop with if condition? You create your phi vector and after just change the sign of ...

4 years ago | 1

| accepted

Answered
How to tabulate?
You can use interp1. dn=1:1:365; x=(360/365*(dn+284)); sdelta=23.45*(sind(x)*pi/180); dni = [15, 45, 75, 105, 135, 165, 195...

4 years ago | 0

| accepted

Answered
Hello, I get an error when trying to make a 3d plot using the mesh and meshgrid functions. I don't understand the Property Value Pairs Expected' error that I get.
Replace the line: a_1 = mesh(x,y,psi_11(x,y),'k'); with a_1 = mesh(x,y,psi_11(x,y)); You have already provided color data i...

4 years ago | 1

Answered
How plot time varying animated 3D surface of z which depends on x and y as well as time, t such as: z (x, y, t) = exp -(x-5t)^2 + (y- 5t)^2.
t = linspace(0,10) ; x = linspace(0,1) ; % choose your range y = linspace(0,1) ; % choose your range [X,Y] = meshgrid(x...

4 years ago | 0

| accepted

Answered
how to make the output change in a loop
Are you expecting something like this? disp("how many teams ") n=input('Num: ') ; S = struct ; for i=1:n S(i).Team = ...

4 years ago | 0

| accepted

Answered
Coding in m-file, for a func defined in an interval [x0, xn] like Fi(x)(=(c1(i)+c2(i)*sin(w1*(x-x(i)))+c3(i)*cos(w2*(x-x(i)))+c4(i)*sin(w2*(x-x(i)))+c5(i)*cos(w1*(x-x(i))))?
% define c1, c2, c2, c4, c5 and W1, W2 etc n = 100 ; x0 = 1 ; xn = 10 ; x = linspace(x0,xn,n) ; F = zeros(n-1,1) ; fo...

4 years ago | 0

Answered
Reading .txt files from the folder and extracting data
https://in.mathworks.com/matlabcentral/answers/245959-how-to-read-text-files-from-different-sub-folders-in-a-folder https://in...

4 years ago | 0

Answered
how to plot this ?
As you have a single values, you may plot only a single point. x=5.3; z= 7.8 ; iwant = x*z/(x/z)^2+14*x^2-0.8*z^2 But if y...

4 years ago | 0

| accepted

Answered
Unable to perform assignment because the left and right sides have a different number of elements.
You have not indexed L, so it was 2x1 vector and you are trying to save it into a single element which popped a error. Consider ...

4 years ago | 0

Answered
How to randomly sample a value multiple times from data
Let x,yz be your data. (May be column or matrix) idx = (X-85).^2 + (Y-65).^2 <= 45^2; % get the required indices data of (x...

4 years ago | 0

Answered
How to create a dataset of noisy images
You can add noise using either rand or randn depedning on what kind of noise distribution you want. Or you can blurr your imag...

4 years ago | 0

Answered
how to replace 1 element in matrix
D = A(3,4) % thats it Please don't ask very simple and basic questions in the community. Take a tutorial on basics of MATLAB...

4 years ago | 0

Answered
How can i store the values for each of the 10 iterations of N. i want to store each and every value of the loop.
Note: You have to initialize the arrays x3, y3 L=2; element=10; lambda=1.3; l=lambda/2; X3=[-7.655; 6.534]; Y3=[1.393;-7.0...

4 years ago | 1

| accepted

Answered
currency recognition using image Processing Techniques in matlab
dist is a simple function, this calculates Euclidean distance weight function. You can do it on your own. The Euclidean distan...

4 years ago | 0

Answered
How can i read files inside a folder?
thepath = 'giveyourpathhere' ; files = dir([thepath,filesep,'*.dat']) ; % get .dat files in the folder N = length(files) ; ...

4 years ago | 0

Answered
How to select column 2 in a matrix
A = rand(4,5) ; A2 = A(:,2) % extract second column : this stands for all in this case. The command extract entire row of se...

4 years ago | 0

| accepted

Answered
Find zeros in a large table and replace with average of two previous column values
You can find the zeros using logical indexing or the functon find. Replace those 0 values with NaN and then use the function fi...

4 years ago | 0

Answered
Using loops to perform vector functions
In the function you have given input op which decides wheter to add ot subtract. But you are over writitng the input op inside t...

4 years ago | 0

Answered
reading trivially sorted images 1 by 1 in loop
for i = 1:10 imgName = ['image_',sprintf('%04d',i)] end Also you can consider using the below file exchange function: ht...

4 years ago | 0

Answered
Make scalar data into a vector
a(i)==b(i) gives a logical output i.e. either 0 or 1. If a and b are vectors a == b, gives a logical vector as output having 1 ...

4 years ago | 0

Answered
How to use variable names/strings in a For cycle
You need not to do that.....it is sheer waste of time and not a good coding practise. You can save the data into a 3D matrix. Th...

4 years ago | 0

| accepted

Answered
imagesc or equivalent with datetime as x axis.
times = datetime('now') + hours(0:1:50); yvals = 0:5:100; colors=randn(size(yvals,2),size(times,2)) + yvals'; im=imagesc(co...

4 years ago | 0

Load more