Answered
Matlab: How to plot the function $P(x)$ versus $x$, where $P(x)=\int_0^\infty f(y)W(x,y)dy$?
y=1:.01:5; x=0:.01:7; [X,Y]=meshgrid(x,y); W=exp(-X.^2./Y); f=y.^2;%as an example I=trapz(W.*f')/.01;%each column of I is t...

4 years ago | 0

Answered
How to find elements in common between two cell arrays?
load('B_90.mat'); A=B; load('B_120.mat'); I=intersect(A{1},B{1},'rows');%as an example points in common between A{1} and B{1}...

4 years ago | 1

| accepted

Answered
MATRIX PROBLEM IN MATLAB
You are indexing into regime with an array (aa) which is 1:2. Not sure what you want array (aa) to be: j=1:3; aa=1:(j+1);%this...

4 years ago | 0

| accepted

Answered
Writing a summation code where i≠j
No loops needed G=sum(w.*x.*x','all')/sum(x.*x','all');

4 years ago | 0

Answered
How do I replace every value in a column with a value from a lookup table?
interp1(X,Y,A)

4 years ago | 0

| accepted

Answered
how to I write sqrt{x}+sqrt{1+x}=4 in mathlab
eqn=@(x)sqrt(x)+sqrt(1+x)-4; f=fzero(eqn,3)

4 years ago | 0

| accepted

Answered
Randomly choose one nonzero element in each row of matrix
Need a single loop in third dimension. ex=randi(2,10,17,12)-1; E=permute(ex,[2,1,3]); [r,c]=find(E); N=zeros(size(ex,1),1,si...

4 years ago | 0

| accepted

Answered
How to write the program for pick the first five element from an array than next five and store their individual sum in new array?
a=randi(100,1,50);%an array n=sum(reshape(a,5,[]));%sum of 5 elements placed in new array

4 years ago | 0

| accepted

Answered
string text manipulation - adding data based on previous data in the string
m=replace(m,'element1','element1CMD'); m=replace(m,'element2','element2CMD'); m=replace(m,'element3','element3RPT');

4 years ago | 0

Answered
The graph is coming out blank
Index and plot after completion of loop. f=@(x,y) -y/.1; x=input('\n Ingrese el valor inicial de x0: '); y=input('\n Ingres...

4 years ago | 1

Solved


Determine whether a number is practical
A number is practical if all smaller numbers can be written as a sum of the proper divisors of . The number 24 is practical bec...

4 years ago

Solved


Matrix Transposition
Given a matrix and an index, perform matrix transposition as follows - Replace non-corner value of ith ring from outside, with...

4 years ago

Answered
Problem selecting specific data in time series
d=diff(day(T.Datetime)); f=find(d==0); F=[f;f+1]; newT=T(F(:),:);

4 years ago | 0

| accepted

Answered
Converting string to function/number
Look at eval function (normally not recommended). a='cos(1)'; eval(a)

4 years ago | 0

Answered
How to divide a 2d array into blocks and create an array with the mean value of each block?
C=blockproc(B, [2 2], @(block_struct) mean(block_struct.data(:),'omitnan'))

4 years ago | 0

Solved


Define an arithmetic sequence
Given three numbers n, a, and d, define an arithmetic sequence of n terms with a being the initial term of the sequence and d be...

4 years ago

Answered
How to plot digital sequence in MATLAB
n=1:length(u); a=1.7; plot(n,a.^n.*u);%assuming u is a vector

4 years ago | 0

| accepted

Answered
Replace NaN values in a matrix with values from another matrix
B(isnan(B))=A(isnan(B));

4 years ago | 1

| accepted

Answered
Error using plot Vectors must be the same length.
t = linspace(0,1,n);%vector t needs to be same length as y_m

4 years ago | 0

| accepted

Answered
How do I change the sign without altering the other and how can I do the factorial denominator? 1-1/3!+1/5!-1/7!+... and perform the sum?
disp('serie 4: 1-1/3!+1/5!-1/7!+...' ) n=input('Enter a number: '); Sum=0; for j=1:n Sum = Sum + (-1)^(j+1)/factorial(2*...

4 years ago | 0

| accepted

Solved


Accumulate Cells
Given a combining function, a cell array, and an initial value, accumulate the result. For example, accumcell(@plus,{1,...

4 years ago

Solved


Generate the Figure-Figure sequence
After discussing Scott Kim’s FIGURE-FIGURE Figure (below) in Gödel, Escher, Bach, Douglas Hofstadter introduced an integer seque...

4 years ago

Answered
average for all looping
No loop needed. average_a=mean(randi(10,1,10))

4 years ago | 0

| accepted

Solved


Find the slope of a line that passes through two vectors
Given two vectors p1 and p2, return the slope of a line that passes through p1 and p2. Examples: Input [p1,p2] = deal([0,1],[...

4 years ago

Answered
extracting data from set of data
t=readtable('owid-covid-data_2020-21.csv'); u=unique(t.Location); count=0; for k=1:length(u) m=movsum(diff(t.TotalCases(...

4 years ago | 0

Answered
Compare a vector values with martix having multiple rows
yourMatrix=[randi(2,20,2),5*rand(20,3)]; yourVector=5*rand(20,3); newMatrix=yourMatrix(yourMatrix(:,3)<=yourVector(1)|yourMatr...

4 years ago | 0

| accepted

Answered
sorting a matrix by another matrix
A(:,B)

4 years ago | 0

Answered
Multiple plots in one figure (not subplot)
Look at stackedplot tbl = readtable("patients.xls","TextType","string"); stackedplot(tbl,["Height","Weight","Systolic","Diasto...

4 years ago | 0

| accepted

Answered
Can I add a text annotation to a tiledlayout figure?
subPlotNames = 'ABCDEFGH'; fig = figure(1); hold on; set(gca,'FontSize',12,'FontName','Calibri'); for i = 1:8 x=randi(r...

4 years ago | 0

| accepted

Load more