Answered
Square Matris (diagonal)
n = 4 ; iwant = diag(1:n) with loop: n = 4 ; iwant = zeros(n) ; for i = 1:n iwant(i,i) = i ; end iwant

5 years ago | 0

Answered
how to read multiple csv files and plot them together
csvFiles = dir('*.csv') ; N = length(csvFiles) ; for i = 1:N T = readtable(csvFiles(i).name) ; % Do what ever you w...

5 years ago | 0

| accepted

Answered
How to separate long time series data to daily overlay?
load tsdata.mat ; [y,m,d,H,M,S] = datevec(date) ; % GEt unique days [c,ia,ib] = unique(d) ; N = length(c) ; figure hol...

5 years ago | 0

Answered
plz explain what does this code do..?
[V, D] = eig(cov(M)); % Calculates the eigenvalues and eigenvectors of covariance of matrix M [z1 s1] = size(D); % gets the ...

5 years ago | 1

| accepted

Answered
advance a vector coordinates in a loop
m = 25 ; n = 25 ; x = linspace(0,1,m) ; y = linspace(0,1,n) ; dx = min(diff(x)) ; dy = min(diff(y)) ; dxy = sqrt(dx^2+dy^2)...

5 years ago | 0

Answered
Color plot for material properties?
Read about patch, you can provide nodal connectivity data and plot the required. Also you can do iinterpolation from element c...

5 years ago | 1

| accepted

Answered
How can i multiply multiple signal wave with different matrix dimension?
Get the signals to equal size as shwon below: a=14; b=17; c=19; N = 50 ; n = linspace(-a,a,N); n1 = linspace(-b,b,N) ; ...

5 years ago | 1

| accepted

Answered
How to move an image inside a computational grid?
I = imread('peppers.png') ; [X,Y] = meshgrid(1:100,1:100) ; plot(X,Y,'r') ; hold on plot(X',Y','r') ; image([20 50]...

5 years ago | 0

Answered
How to plot and create a Gravity-Altitude graph?
You need to input z values....Do you have those values along with lat, lon? You may check the below example with dummy data. ...

5 years ago | 1

Answered
Reading excel file sheets
It is suggested to use readtable instead. filename = 'timeframe_wodsm.xls'; data = = cell(4,1) ; for i = 1:4 data{i} =...

5 years ago | 0

| accepted

Answered
is this code of plotting correct?
load samples % Fit a line to data p1 = polyfit(t,y,1) ; y1 = polyval(p1,t) ; % Fit second degree polynomial to data p2 =...

5 years ago | 0

Answered
why do I still get error with syntax
p=1000; e=0.25; %create function handle r = @(theta) p\(1-(e*cos(theta))) %<--- bracket is needed here %use ezpolar to p...

5 years ago | 0

Answered
How to perform mathematical conditions
Use atan2 instead of atan. function alfa= fas(O,Q) a=O/Q; b=1-O.^2; alfa = atan2(-a, b); end

5 years ago | 0

Answered
Controu plot from matlab table
x = T.x ; y = T.y ; z = T.z ; nx = length(unique(x)) ; ny = length(unique(y)) ; X = reshape(x,nx,ny) ; Y = reshape(y,nx...

5 years ago | 0

Answered
Index exceeds the number of array elements (1).
The error is clear, you are trying to extract more number of elements then pesent in the array. EXample: A = rand(1,10) ; A...

5 years ago | 0

| accepted

Answered
Transform matrix into vector X Y Z
You may follow something like this: A = [2 2 3 1 5 7 9 8 7]; [m,n] = size(A) ; [X,Y] = meshgrid(1:n,1:m) ;...

5 years ago | 2

| accepted

Answered
Getting a increasing by the nxn matrix inside a for loop
n=100 ; matrixA = cell(n,1) ; for i=1:n matrixA{i} = rand(n) ; end

5 years ago | 0

| accepted

Answered
Can someone solve this Error for me? Thank you
Replace lines: leye = [L eye(n)]; ueye = [U eye(n)]; with: leye = [L eye(size(L,1))]; ueye = [U eye(size(U,1))];

5 years ago | 0

Answered
Error "Matrix dimensions must agree" in the line "T = norm(rref(Y)- rref(U)) < tol;" I used "A=[1 1 4;0 -4 0;-5 -1 -8; 2 3 -1] [L,U] = eluinv(A);" in my livescript. Thank you so much!
Replace the line: T = norm(rref(Y)- rref(U)) < tol; with T = (norm(rref(Y))- norm(rref(U))) < tol;

5 years ago | 0

| accepted

Answered
Error using Zeros, size input must be integers.
Qd=zeros(round(size(Q,1)/24),length(A)); for i=1:length(A) for d=1:round(size(Q,1)/24) bk=Q(1+24*(d-1):24*d,i); ...

5 years ago | 0

| accepted

Answered
How to split a range of numbers with uniform intervals between the values
t = linspace(0.1,1.5,10)

5 years ago | 0

| accepted

Answered
Guess the which of the below given statements are true for function polyfit?
Instead of posing an easy question here, you can go to the documentation and check it yourselves. https://in.mathworks.com/hel...

5 years ago | 0

Answered
Finding and saving slopes of individual lines generated using for loop
hold on for i=2:2:6 j=i-1 plot(T(:,j),T(:,i)) end hold on slope = zeros([],1) ; count = 0 ; for i=2:2:6 ...

5 years ago | 1

| accepted

Answered
How can I use summation and product, simultaneously???
Something like this: m = 2 ; % i n = 3 ; % j C = rand(m,1) ; k = rand(m,n) ; M = rand(m,n) ; iwant = zeros(m,1) ...

5 years ago | 0

| accepted

Answered
my program is not working and i don't know why ?
When you are writitng lines of code in next line use ........, you cannot split the number to next line. Also your code need ini...

5 years ago | 0

Answered
Could MATLAB do text-mirroring?
I = imread('image.png') ; % read image I1 = fliplr(I) ; % flip the image imshow(I1)

5 years ago | 0

Answered
Index value intersection query in matlab
a = round (x); b = round (y); for k = 1:length(a) index (k,:) = rms(b(k),a(k)); end index = index';

5 years ago | 0

| accepted

Answered
Error in dlmwrite (line 181)
Read about writetable https://in.mathworks.com/help/matlab/ref/writetable.html

5 years ago | 1

| accepted

Answered
trying to integrate and differentiate a graph
clear corner=[-2 0 ;-1 1;1 1;3 4;4 2;7 0;8 0]; %plot(corner); x=[-3 ;-1; 1; 3; 4;8]; y=[0 ,1 , -2, 4, 2,0]; % diffrent...

5 years ago | 0

Answered
Replacing all even numbers in my matrix with their square root value
A=[1 4 9; 8 16 7; 3 36 4] idx = mod(A,2) ; A(idx==0) = sqrt(A(idx==0))

5 years ago | 0

Load more