Answered
Calculate % difference for 2 vectors into a matrix
FR1=rand(1,158);FR2=rand(1,158); [fr1,fr2]=meshgrid(FR1,FR2); percentDifference=(fr2-fr1)./fr1*100;

4 years ago | 0

Answered
How to improve sparse array indexed assignment in MATLAB?
s=readmatrix('quinn.txt','Range','C3:D3'); r=readmatrix('quinn.txt','NumHeaderLines',3); X=sparse(s(2),s(1)); ra=abs(r(:,1:2)...

4 years ago | 1

Answered
how to find points inside a 3d delaunayTriangulation object?
p=pointLocation(s,[x,y,z]); f=find(~isnan(p));%index of points (x,y,z) inside

4 years ago | 0

| accepted

Answered
Fitting the curve problem
[fitcurve,gof]=fit(duration_fit,y_duration_fit,'fourier5');%fourier5 does not look too bad

4 years ago | 0

Answered
How to add the same headers to all matrices in a loop
files=dir('*.mat'); m=[]; for i=1:length(files) t=struct2cell(load(files(i).name)); m=[m;table2array(t{1})]; end T...

4 years ago | 0

Answered
I need a function to go to a table in the workspace and return a table with specfic values from a specfic colmun.
Convert all your tables to arrays and store in a single cell array. load('Table1.mat');load('Table2.mat'); c={table2array(Tabl...

4 years ago | 2

Answered
How to calculate mean square error between points?
load('x_T.mat');load('x_T_est1.mat');load('y_T.mat');load('y_T_est1.mat'); b=[reshape(x_T_est1(all(x_T_est1,2),:),[1,numel(x_T_...

4 years ago | 0

| accepted

Answered
set the unit step function
Not sure what you are after. I assumed step function at n positions with applitudes 1:6 z=1:6; n=0:5; x=-1:.1:10; scatter(x,...

4 years ago | 0

Answered
Incorrect output of sortrows function
B=sortrows(A);%if you just sort based on columns [1 2] no sorting will happen since then are all equal

4 years ago | 0

| accepted

Answered
How to replace all nan values in an image to 255 different colors
idx=yourImage==nan; N=nnz(idx); yourImage(idx)=uint8(randi(255,1,N));

4 years ago | 0

Answered
Changing values in matrix under certain conditions
newMatrix=yourMatrix>16;

4 years ago | 0

| accepted

Answered
How to create Matrix [1 2 3 4; 2 4 6 8; 3 6 9 12; 4 8 12 16] without using loops or any functions using loops?
A = [1 2 3 4; 2 4 6 8; 3 6 9 12; 4 8 12 16];%what is wrong with this You could also do something like: n=4; A=[1:n;2:2:2*n;3:...

4 years ago | 1

Answered
Function inside for-loop won't transfer elemnt into main program's vector
[~,~,~,~,Vm1(p)]=Bildauswertung(fullFileName);%you could also just assign it without an additional line

4 years ago | 0

Answered
How to pick the minimum value from column1(flowrate) with respect to each value from column2(head)?
s=readmatrix('S-Curve.csv'); a=[]; u=unique(s(:,2)); for k=1:length(u) m=min(s(s(:,2)==u(k),1)); a=[a,m(1)]; end ...

4 years ago | 1

| accepted

Answered
Function inside for-loop won't transfer elemnt into main program's vector
for p = 1 : length(theFiles) % for-loop to go through every single PNG-file in the folder % baseFileName = theFiles(p)....

4 years ago | 1

| accepted

Answered
Why does this function handle not work?
fun = @(t) A0.*(k./(kaccent+k)).*(1-((exp(1)).^(-((k+kaccent).*t))));

4 years ago | 0

| accepted

Answered
dy/dt = (y+t^2-2)/t+2 ; y(0)=2 help me to solve this am new here struggling to find right coding term for this
syms y(t) ode = diff(y,t) == exp(y+t^2-2)/t+2 ; cond = y(0) == 2; ySol(t) = dsolve(ode,cond);

4 years ago | 0

| accepted

Answered
how to write summation in power series
i=1:100; a=randi(100,1,100); t=.9; s=sum(a.*t.^i);

4 years ago | 0

| accepted

Answered
Counting the amount of number 1
Count=sum(yourMatrix==1);%assuming other than 1's and 0's are possible

4 years ago | 0

| accepted

Answered
How to find the maximum value from a matrix without using max syntax?
s=sort(A); maxValue=s(end);

4 years ago | 0

Answered
How to correctly implement a formula that describes the deformation of a plate
a=10;b=15;q=5;k=41;%do not know values [m,n]=meshgrid(1:2:1000); w=@(x,y)16*q/k/(pi^6)*sum(1./(m.*n.*(m.^2/a^2 + n.^2/b^2).^2)...

4 years ago | 0

Solved


time difference
The arrays x and y contain time values in the form of: x = [hours minutes seconds] Create the output z which contains the...

4 years ago

Solved


make histogram
You probably know the function hist(x,n) to get the histogram. Now try to write the function yourself! For the cheaters wanting...

4 years ago

Solved


Find unique number in input
Find value that occurs in odd number of input elements.

4 years ago

Answered
Submit solution for cody but my code has a built-in function
Change your function name to match (inOrOut). Cody will fail because it does not support the mapping toolbox which is needed for...

4 years ago | 0

Solved


Determine whether a given point is inside or outside a polygon
A closed polygon may be described by an N x 2 array of nodes, where the last node and the first node are the same. Each row of t...

4 years ago

Answered
Can't figure out operator use error
x = linspace(0,1,50); y = linspace(0,1,50); u=zeros(50); for i =1:length(x) for j =1: length(y) u(i,j) = (1/sin...

4 years ago | 0

| accepted

Answered
How to find sum of row vector and check this is equal to 0?
idx=sum(D==0,2)<=1&sum(D,2)==0; d=D(idx,:); e=E(idx,:);

4 years ago | 0

Answered
For loop to do 900 subtractions
yx=sqrt(BR^2-B(1)^2)-sum(sqrt(BB^2-B.^2))-sum(sqrt(BR^2-B(2:end).^2));

4 years ago | 0

Answered
How to calculate the centroid / center of a patch?
pgon=polyshape(X,Y); [x,y]=centroid(pgon);

4 years ago | 2

| accepted

Load more