Answered

Add an increment to a matrix [1x50]

velocity_temp=[20:-.5:9,7.5:-1.5:0];

Add an increment to a matrix [1x50]

velocity_temp=[20:-.5:9,7.5:-1.5:0];

5 dagen ago | 1

| accepted

Answered

Plotting 2 functions on the same graph

syms x; y = (2*x-1)/(x+1); fplot(y); hold on g = finverse(y); fplot(g) grid;

Plotting 2 functions on the same graph

syms x; y = (2*x-1)/(x+1); fplot(y); hold on g = finverse(y); fplot(g) grid;

5 dagen ago | 1

Answered

Calling a function without an Output argument

Change the number of input arguments instead function y=Myplot(varagin) y=figure; if nargin==2 subplot(2,1,1); ...

Calling a function without an Output argument

Change the number of input arguments instead function y=Myplot(varagin) y=figure; if nargin==2 subplot(2,1,1); ...

6 dagen ago | 0

Answered

How to find value of function for array of inputs ?

f=@(x)x.^2; x=[1 3 4 6]; y=f(x);

How to find value of function for array of inputs ?

f=@(x)x.^2; x=[1 3 4 6]; y=f(x);

8 dagen ago | 1

Answered

Fit of own function in plot

The documentation in fit() function is good. Just follow the guidance on fit a curve defined by a file. https://www.mathworks.c...

Fit of own function in plot

The documentation in fit() function is good. Just follow the guidance on fit a curve defined by a file. https://www.mathworks.c...

8 dagen ago | 0

Answered

Defining equations which include summation of n-values

I assume alpha, A0, t, and g are contant scalars. theta=0:.01:2*pi;%depending on what you want values you want for theta C=ar...

Defining equations which include summation of n-values

I assume alpha, A0, t, and g are contant scalars. theta=0:.01:2*pi;%depending on what you want values you want for theta C=ar...

8 dagen ago | 1

Answered

How can i use for loop instead of this?

No loop needed. n*(n-1)*(n-2).../factorial() is just -1 or 1 alternating, placed -1 with x raised to power to alternate this sig...

How can i use for loop instead of this?

No loop needed. n*(n-1)*(n-2).../factorial() is just -1 or 1 alternating, placed -1 with x raised to power to alternate this sig...

8 dagen ago | 1

| accepted

Answered

Passing vector argument into a function returns only one value

function [a] = ustep(n) a=zeros(size(n)); a(n>=0)=1; end

Passing vector argument into a function returns only one value

function [a] = ustep(n) a=zeros(size(n)); a(n>=0)=1; end

8 dagen ago | 1

| accepted

Solved

Calculate mean value of any pair in a vector.

Given a vector A, calculate the mean of 2 number in the vector one by one. example: input: A=[1, 5, 6, 8, 9, 15] output:...

8 dagen ago

Solved

Find all repeated numbers

For a given vector, find all numbers that repeated 2 times or more than 2 times. Example: A=[1 2 3 3 4 5 6 6 7] y=[3 ...

8 dagen ago

Solved

Prime numbers between a , b.

Find all prime number between a & b (including a and b). example: a=100 b=120 y= [101 103 107 109 113]

8 dagen ago

Solved

Draw 'O' !

Given n as input, generate a n-by-n matrix 'O' using 0 and 1 . example: n=4 ans= [1 1 1 1 1 0 0 1 ...

8 dagen ago

Solved

Draw 'C'.

Given x as input, generate a x-by-x matrix 'C' using 0 and 1. example: x=4 ans= [0 1 1 1 1 0 0 0 ...

8 dagen ago

Solved

Draw 'F'

Draw a x-by-x matrix 'F' using 1 and 0. (x is odd and bigger than 4) Example: x=5 ans= [1 1 1 1 1 1 0 0 0 0 ...

8 dagen ago

Solved

Draw 'D'.

Draw a x-by-x matrix 'D' using 0 and 1. example: x=4 ans= [1 1 1 0 1 0 0 1 1 0 0 1 1 1 1 0]

8 dagen ago

Solved

Draw a 'N'!

Given n as input, generate a n-by-n matrix 'N' using 0 and 1 . Example: n=5 ans= [1 0 0 0 1 1 1 0 0 1 1 0 ...

8 dagen ago

Solved

Draw 'E'

Draw a x-by-x matrix 'E' using 1 and 0. (x is odd and bigger than 4) Example: x=5 ans= [1 1 1 1 1 1 0 0 0 0 ...

8 dagen ago

Solved

Draw a 'Z'.

Given _n_ as input, generate a n-by-n matrix like 'Z' by _0_ and _1_ . Example: n=5 ans= [1 1 1 1 1 0 0 0 1 ...

8 dagen ago

Solved

Draw 'B'

Draw a x-by-x matrix 'B' using 1 and 0. (x is odd and bigger than 4) Example: x=5 ans= [1 1 1 1 0 1 0 0 0 1 ...

8 dagen ago

Solved

Draw 'J'

Given n as input, generate a n-by-n matrix 'J' using 0 and 1 . Example: n=5 ans= [0 0 0 0 1 0 0 0 0 1 0 0 ...

8 dagen ago

Solved

Draw 'H'

Draw a x-by-x matrix 'H' using 1 and 0. (x is odd and bigger than 2) Example: x=5 ans= [1 0 0 0 1 1 0 0 0 1 ...

8 dagen ago

Answered

How to generate the sum of a random number ?

n = randn; x = 0; while x <= 9 n = randn;%needs to be in the loop if n > 3 fprintf('The random number is gr...

How to generate the sum of a random number ?

n = randn; x = 0; while x <= 9 n = randn;%needs to be in the loop if n > 3 fprintf('The random number is gr...

9 dagen ago | 0

| accepted

Answered

Plotting a function within for loop

function RetractionModel2 AB = 0.0732; AD = 0.0788; BC = 0.0585; CD = 0.0575; a0 = 99.4; for i= 0:90 alpha = a0 -...

Plotting a function within for loop

function RetractionModel2 AB = 0.0732; AD = 0.0788; BC = 0.0585; CD = 0.0575; a0 = 99.4; for i= 0:90 alpha = a0 -...

9 dagen ago | 1

| accepted

Answered

how to get all max values of one vector

m=X(ismember(X,max(X)));

how to get all max values of one vector

m=X(ismember(X,max(X)));

9 dagen ago | 0

| accepted

Answered

How to index in for loop

for k=1:length(a) c(:,:,k)=a(k)*b;%index instead of having different variables d(:,:,k)=r-c(:,:,k)*x; end

How to index in for loop

for k=1:length(a) c(:,:,k)=a(k)*b;%index instead of having different variables d(:,:,k)=r-c(:,:,k)*x; end

9 dagen ago | 0

| accepted

Answered

Repeating a function for different values and storing the output in different variables.

for k=1:10%however many times you want to run it P{k}=points_on_plane(p0,p1,p2);%just use a cell array for your output so tha...

Repeating a function for different values and storing the output in different variables.

for k=1:10%however many times you want to run it P{k}=points_on_plane(p0,p1,p2);%just use a cell array for your output so tha...

9 dagen ago | 0

| accepted

Answered

How to plot the figure with 3 variables in 2d, with the value of z is proportional to the color?

m=min(Detal_E); M=max(Detal_E); c=(Detal_E-m)/(M-m)*9+1; scatter(X,Y,25,c,'filled');

How to plot the figure with 3 variables in 2d, with the value of z is proportional to the color?

m=min(Detal_E); M=max(Detal_E); c=(Detal_E-m)/(M-m)*9+1; scatter(X,Y,25,c,'filled');

9 dagen ago | 0

| accepted

Answered

"Index exceeds the number of array elements" Spring Mass Damper System

for i=1:N t(i+1) = t(i)+h; x(i+1) = x(i)+h*(v(i)); v(i+1) = v(i)+h*(u(i)-(c/m)*v(i)-(k/m)*x(i));%appears your problem i...

"Index exceeds the number of array elements" Spring Mass Damper System

for i=1:N t(i+1) = t(i)+h; x(i+1) = x(i)+h*(v(i)); v(i+1) = v(i)+h*(u(i)-(c/m)*v(i)-(k/m)*x(i));%appears your problem i...

9 dagen ago | 1

| accepted