Answered

How to store multiples matrices in the same output?

c=m(:,m(1,:)==1); p=m(:,m(1,:)==0);

How to store multiples matrices in the same output?

c=m(:,m(1,:)==1); p=m(:,m(1,:)==0);

3 giorni ago | 1

Solved

PEMDAS test (★★)

Create the function that will return the following expression for x and y. <<https://i.ibb.co/RHWyzrv/Code-Cogs-Eqn-1.gif>> ...

4 giorni ago

Answered

How to index an output without creating intermediate variable?

CellWithStuff{find(contains(CellWithStuff,'o'),1)}; CellWithStuff(find(contains(CellWithStuff,'o'),1));%depending on what you w...

How to index an output without creating intermediate variable?

CellWithStuff{find(contains(CellWithStuff,'o'),1)}; CellWithStuff(find(contains(CellWithStuff,'o'),1));%depending on what you w...

4 giorni ago | 0

Answered

Combining two codes into one?

It does not matter if the shifts are done sequentually. a=circshift(circshift(image,100,1),100,2); b=circshift(circshift(image...

Combining two codes into one?

It does not matter if the shifts are done sequentually. a=circshift(circshift(image,100,1),100,2); b=circshift(circshift(image...

4 giorni ago | 0

Answered

Calculating Percent Difference at specific intervals

m=zeros(1,5); for i=2:5 a= find(t==i); m(i)=abs(x(a)-x1(a))/mean([x(a),x1(a)]); end

Calculating Percent Difference at specific intervals

m=zeros(1,5); for i=2:5 a= find(t==i); m(i)=abs(x(a)-x1(a))/mean([x(a),x1(a)]); end

4 giorni ago | 1

| accepted

Answered

Write a function called corners that takes a matrix as an input argument and returns four outputs.I'm sure about my answer but I can't find my mistake.

There is nothing wrong with your function. function [topleft, topright, bottomleft, bottomright]=corners(A) topleft=A(1,1);%...

Write a function called corners that takes a matrix as an input argument and returns four outputs.I'm sure about my answer but I can't find my mistake.

There is nothing wrong with your function. function [topleft, topright, bottomleft, bottomright]=corners(A) topleft=A(1,1);%...

4 giorni ago | 0

Answered

Shifting an image vertically

circshift(image,100,1);%Do you want to circular shift the image up/down by 100 pixels? image(1:end-99,:,:);%Or just truncate 1...

Shifting an image vertically

circshift(image,100,1);%Do you want to circular shift the image up/down by 100 pixels? image(1:end-99,:,:);%Or just truncate 1...

4 giorni ago | 0

Answered

How to insert the coding of t^2 power in MATLAB command window

t=0:.01:100; x=@(t)t; h=@(t)t.^2; y=conv(x(t),h(t),'same'); subplot(3,1,1) plot(t,x(t)); subplot(3,1,2) plot(t,h(t)); su...

How to insert the coding of t^2 power in MATLAB command window

t=0:.01:100; x=@(t)t; h=@(t)t.^2; y=conv(x(t),h(t),'same'); subplot(3,1,1) plot(t,x(t)); subplot(3,1,2) plot(t,h(t)); su...

4 giorni ago | 0

Answered

How to vectorize if statement

Looks like f is just a scalar. No vectorization needed. if m<7&&m<sm*.3 f=aSortI(1); else f=0; end

How to vectorize if statement

Looks like f is just a scalar. No vectorization needed. if m<7&&m<sm*.3 f=aSortI(1); else f=0; end

4 giorni ago | 0

| accepted

Answered

Vectorize two for loops

[i,j]=meshgrid(1:100,1:200); TheOne=reshape(sum((Png1(:,i)-Png2(:,j)).^2),100,[]);

Vectorize two for loops

[i,j]=meshgrid(1:100,1:200); TheOne=reshape(sum((Png1(:,i)-Png2(:,j)).^2),100,[]);

4 giorni ago | 0

Solved

root?

* Given a function 'foo', and a position 'there', find the root near 'there'. * For example: If foo=@sin, and there=3.1, then r...

4 giorni ago

Solved

Blood test?

Assuming: the genetic makeup (genotype) of a child is coded as a pair with two components, combining half genotype of one parent...

4 giorni ago

Solved

Back to basics 17 - white space

Covering some basic topics I haven't seen elsewhere on Cody. Remove the trailing white spaces from the input variable

4 giorni ago

Solved

Where do the maximum number belongs within a 3-D matrix?

Suppose, you are given two variables *a* and *b* as inputs in 2-D format. Find out, where do the maximum number belongs (as out...

5 giorni ago

Solved

R2012b atan in Degrees

Return in degrees the atan result of inputs for all four quadrants. *Examples:* [x, y] Degrees 1 0 0 1 1 ...

5 giorni ago

Solved

Plot Line Specifications

Create a line plot for function cos(x) where x is a vector of linearly spaced values going from 0 to input N with an increment o...

5 giorni ago

Solved

Weighted moving average

x1=[1 2 1]; y1=[1 2 2 4 5 6 6 8]; Make function for weighted moving average. z(i)=(x1(i)*y1(i)+x1(i+1)*y1(i+1)+x1(i+2)*y1...

5 giorni ago

Solved

Calculate geostrophic current

eta0=0.01; R=300; f=0.01; g=9.81; x=-500:50:500; y=-500:50:500; [x y]=meshgrid(x,y); eta=eta0*exp(-(x.^2+...

5 giorni ago

Solved

Number of vertices of a hypercube

Return the number of vertices of a n-dimensional hypercube.

5 giorni ago

Solved

Probability of Choosing a Red Ball

Given two jars of red and blue balls, find the probability of choosing a red ball from Jar 1 after going through the steps. ...

5 giorni ago

Solved

Implement zero-based indexing for Matrices

Given an input vector and position (which is zero based) output the value Example: x = [1 2; 4 5] pos = [0 1] value = 5 ...

5 giorni ago

Solved

Path calculation with polynomials

Let a vector x be the input to our function. 1. If a value of an input vector element x is lower than 0, set this value to 0....

5 giorni ago