Answered

vectorisation a for loop

Although arrayfun is really a loop, c=5; retint=0; dist=log([10:-1:1]+retint); discrim=arrayfun(@(x)1/sum(exp(-c*abs(dist-...

vectorisation a for loop

Although arrayfun is really a loop, c=5; retint=0; dist=log([10:-1:1]+retint); discrim=arrayfun(@(x)1/sum(exp(-c*abs(dist-...

environ 10 heures ago | 0

| accepted

Answered

Need help to vectorize a for loop

unimodal=[28 42 46 49 52 55 58 61 64 68 82]; ru=(unimodal-min(unimodal))/(max(unimodal)-min(unimodal)); fu=(0:length(unimodal)...

Need help to vectorize a for loop

unimodal=[28 42 46 49 52 55 58 61 64 68 82]; ru=(unimodal-min(unimodal))/(max(unimodal)-min(unimodal)); fu=(0:length(unimodal)...

environ 10 heures ago | 0

| accepted

Answered

How do I plot the variables outside of the for loop for all iterations?

clc; close all; clear; Patm = 18750; Tatm = 216.7; U = 250; R = 287; gamma_air = 1.4; T04 = 1500; Qr = 45000000; B =...

How do I plot the variables outside of the for loop for all iterations?

clc; close all; clear; Patm = 18750; Tatm = 216.7; U = 250; R = 287; gamma_air = 1.4; T04 = 1500; Qr = 45000000; B =...

environ 10 heures ago | 0

Answered

How I can choose randomly value from cell?

Why not just, a=cell2mat(SI); b=a(randi(length(a)));%b is a random value inside all of SI

How I can choose randomly value from cell?

Why not just, a=cell2mat(SI); b=a(randi(length(a)));%b is a random value inside all of SI

environ 16 heures ago | 0

| accepted

Solved

Outer product of multiple vectors

In tensor algebra, it is often useful to define a tensor as a product of lower order tensors. Similarly, a multidimensional arra...

environ 16 heures ago

Solved

linear least squares fitting

Inputs: * |f|: cell-array of function handles * |x|: column vector of |x| values * |y|: column vector of |y| values, same l...

environ 16 heures ago

Answered

How can I insert the value of a symbol in symbolic matrix and convert it into a numerical matrix?

t=1; subs(GRAM);

How can I insert the value of a symbol in symbolic matrix and convert it into a numerical matrix?

t=1; subs(GRAM);

environ 18 heures ago | 0

Answered

Substitution on symbolic function

syms t x0=input('x0= '); x1=input('x1= '); x2=input('x2= '); y=input('input your function of variable t= '); t=x0; fx0=sub...

Substitution on symbolic function

syms t x0=input('x0= '); x1=input('x1= '); x2=input('x2= '); y=input('input your function of variable t= '); t=x0; fx0=sub...

environ 18 heures ago | 1

| accepted

Answered

Triangle area with two vectors

function Area = TriVecArea(u,v) Area = .5*norm(cross(u,v)); end

Triangle area with two vectors

function Area = TriVecArea(u,v) Area = .5*norm(cross(u,v)); end

environ 20 heures ago | 0

| accepted

Answered

Converting from char to double

This should work for you. A=[40 78]; A=num2str(A); A=str2num(A(A~=' '));

Converting from char to double

This should work for you. A=[40 78]; A=num2str(A); A=str2num(A(A~=' '));

environ 20 heures ago | 0

Solved

Sum the entries of each column of a matrix which satisfy a logical condition.

Given a numeric matrix A and a logical array L of the same size as A, return a row vector S containing the columnwise sums of th...

1 jour ago

Solved

Back to basics 16 - byte order

Covering some basic topics I haven't seen elsewhere on Cody. Switch the byte order of the input (i.e. if little-endian -> big...

1 jour ago

Solved

Back to basics 9 - Indexed References

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix and row and column, output the index of th...

1 jour ago

Solved

What percentage?

Calculate the output c as the percentage of a on b for given a and b.

1 jour ago

Solved

Replace multiples of 5 with NaN

It is required to replace all values in a vector that are multiples of 5 with NaN. Example: input: x = [1 2 5 12 10 7] ...

1 jour ago

Solved

Count decimal digits of a number

* Given an integer number you have to return the number of its digits. * For example 248 has 3 digits and 1589 has 4 digits ...

2 jours ago

Solved

Find the Nth Root of a Given Number

Find the Nth root of a given number x. Examples x = 4096 n = 4 y = 8 x = 625 n = 5 y = 3.6239

2 jours ago

Solved

Sum of Two Numbers

Given two integer numbers x and y, calculate their sum and put it in z. Examples: Inputs x = 2, y = 4 Output z is 6 ...

2 jours ago

Solved

Calculate the Number of Sign Changes in a Row Vector (No Element Is Zero)

For a row vector: V=[7 1 2 -3] there is one sign change (from 2 to -3). So, the function you write must return N=1. F...

2 jours ago

Solved

Create an index-powered vector

Given a input vector x, return y as index-powered vector as shown below. Example x = [2 3 6 9] then y should be [...

2 jours ago

Solved

Count consecutive 0's in between values of 1

So you have some vector that contains 1's and 0's, and the goal is to return a vector that gives the number of 0's between each ...

2 jours ago

Solved

find radius of cone

if Slant height of Cone(I)& hight of Cone(H) given then find radius of the Cone(R) for example I=5,h=4 then the ans R=3;

2 jours ago

Solved

find the surface area of a cube

given cube side length x, find the surface area of the cube, set it equal to y

2 jours ago

Solved

Building matrices

If you have matrix A, create matrix B using matrix A as an "element" A = [1 2 3 4; 5 6 7 8...

2 jours ago

Solved

Deleting an element in a matrix

For vector Grades=[98 56 78 34 100 88 87], delete the number 78 to get the following matrix Grades=[98 56 34 100 88 87] **re...

2 jours ago

Solved

Generate a string like abbcccddddeeeee

This is the string version of Problem 1035. <http://www.mathworks.com/matlabcentral/cody/problems/1035-generate-a-vector-like-1-...

2 jours ago