Answered

creating multiple values of the same x,y,z

x=[ 2, 4, 2]; repmat(x,10,1)

creating multiple values of the same x,y,z

x=[ 2, 4, 2]; repmat(x,10,1)

18 days ago | 0

| accepted

Answered

no data plots on graph (plot (x,y))

David is correct. Why don't you try something like that in your code... d(1) = 32000; H = 8000; Re = 6370000; %c2 = 0.5*exp(...

no data plots on graph (plot (x,y))

David is correct. Why don't you try something like that in your code... d(1) = 32000; H = 8000; Re = 6370000; %c2 = 0.5*exp(...

18 days ago | 0

| accepted

Answered

Invalid syntax error with a simple code

tray this x = [-2 -1.5 -1 -0.5 0 0.5 1 1.5 2]; y = (x+x.*(sqrt(x+3))).*(1+2*(x.^(2)));

Invalid syntax error with a simple code

tray this x = [-2 -1.5 -1 -0.5 0 0.5 1 1.5 2]; y = (x+x.*(sqrt(x+3))).*(1+2*(x.^(2)));

21 days ago | 0

| accepted

Answered

How can I obtain slope of a trend line calculated for a time serie

Maybe this is useful for you https://www.mathworks.com/help/matlab/ref/detrend.html

How can I obtain slope of a trend line calculated for a time serie

Maybe this is useful for you https://www.mathworks.com/help/matlab/ref/detrend.html

27 days ago | 0

Solved

Find the repeating elements and repetitions of a row vector.

So let's say that x is a vector, for example, x = [4, 4, 5, 5, 5, 6, 7, 7，8, 8, 8, 8] Now we want to get the following two ve...

30 days ago

Answered

Why does my plot not appear?

Vmax = 354*10^(-6); Km = 1.5*10^(-3); S = .0000005:.0000005:.000030; v = Vmax*S./(Km + S); plot(S,v);

Why does my plot not appear?

Vmax = 354*10^(-6); Km = 1.5*10^(-3); S = .0000005:.0000005:.000030; v = Vmax*S./(Km + S); plot(S,v);

1 month ago | 0

Answered

Multiple Iterations over a system of linear equations

I think the problem is where the plot function, maybe you need to put another command to plot in each iteration, something like ...

Multiple Iterations over a system of linear equations

I think the problem is where the plot function, maybe you need to put another command to plot in each iteration, something like ...

1 month ago | 0

Answered

for loop and if-statement

This may help you Time=[0.5 1.51 2.6 3.65 4.71 6.8 7.9 9.1 10.3 11.1 12.3 15 16.2 17.3 18.5 19.6]; dife=diff(Time); heelstrik...

for loop and if-statement

This may help you Time=[0.5 1.51 2.6 3.65 4.71 6.8 7.9 9.1 10.3 11.1 12.3 15 16.2 17.3 18.5 19.6]; dife=diff(Time); heelstrik...

1 month ago | 0

| accepted

Solved

Vertical matrix sort

Given a matrix x with n rows and m columns, return a matrix y with 2n rows and m columns, such that every column in x is sorted ...

2 months ago

Solved

Diagonal Pattern

For a positive integer |n|, return an |nXn| matrix |mat| such that the value of each element in row |i| and column |j| is given ...

2 months ago

Answered

"Z must be a matrix, not a scalar or vector." PLEASE HELP!

x1 = 1:.1:4; x2 = 1:.1:4; [X,Y] = meshgrid(x1,x2); Z= ps2func(X,Y); mesh(X,Y,Z) grid on hold on function [f]=ps2func(x...

"Z must be a matrix, not a scalar or vector." PLEASE HELP!

x1 = 1:.1:4; x2 = 1:.1:4; [X,Y] = meshgrid(x1,x2); Z= ps2func(X,Y); mesh(X,Y,Z) grid on hold on function [f]=ps2func(x...

2 months ago | 1

Answered

Converting Euler's method calculation into matlab

tray this: % Initial conditions and setup Q=400; A=1200; alph=160; h = 0.5; % step size t = 0:0.5:10; % the range of t ...

Converting Euler's method calculation into matlab

tray this: % Initial conditions and setup Q=400; A=1200; alph=160; h = 0.5; % step size t = 0:0.5:10; % the range of t ...

2 months ago | 1

| accepted

Answered

Lotka-Volterra Predatir Prey Model Code

using this: function [dPdt] = lotkavolterra(t,P) alpha = 1.5; % you have error here: you using alpa beta = 1; gamma = 3; de...

Lotka-Volterra Predatir Prey Model Code

using this: function [dPdt] = lotkavolterra(t,P) alpha = 1.5; % you have error here: you using alpa beta = 1; gamma = 3; de...

2 months ago | 0

| accepted

Solved

Counting Sequence

Given a vector x, find the "counting sequence" y. A counting sequence is formed by "counting" the entries in a given sequence...

3 months ago

Answered

¿Por qué mi código no corre?

Hola, Creo que tu condicion incial debe ser de solo dos elementos y no de tres. Intenta este programa principal, el cual llamará...

¿Por qué mi código no corre?

Hola, Creo que tu condicion incial debe ser de solo dos elementos y no de tres. Intenta este programa principal, el cual llamará...

3 months ago | 0

Solved

Triangle of numbers

Create a matrix with the integers from 1 to |n| arranged in a triangular shape. Every row |i| of the matrix contains |i| inte...

3 months ago

Answered

How do I plot a function that has been split into multiple time intervals

I don't know if I understand your problem, but I think it is related to the way to program the following code: t=-1:0.1:6; y...

How do I plot a function that has been split into multiple time intervals

I don't know if I understand your problem, but I think it is related to the way to program the following code: t=-1:0.1:6; y...

3 months ago | 0

Solved

Back to basics 2 - Function Path

Covering some basic topics I haven't seen elsewhere on Cody. Given a string that is the name of a MATLAB function, return a s...

3 months ago

Solved

Prime factor digits

Consider the following number system. Calculate the prime factorization for each number n, then represent the prime factors in a...

3 months ago

Answered

How do I display squares of all even integers from zero to some positive integer input by the the user.And the program must continuously request a number from the user untill a valid a positive integer is entered

M=input('enter integer:'); for c=0:M if mod(c,2)==0 c^2 end end

How do I display squares of all even integers from zero to some positive integer input by the the user.And the program must continuously request a number from the user untill a valid a positive integer is entered

M=input('enter integer:'); for c=0:M if mod(c,2)==0 c^2 end end

3 months ago | 0

Answered

hi I am trying to calculate the 4th root of the function f(x)=3x4+7x3−4x2−10x+15 using newtons method and a for - loop

clear clc close all % function f = @(x) 3*x.^4 + 7*x.^3 - 4*x.^2 - 10*x + 1/5; % derivative df = @(x) 12*x.^3 + 21*x.^2...

hi I am trying to calculate the 4th root of the function f(x)=3x4+7x3−4x2−10x+15 using newtons method and a for - loop

clear clc close all % function f = @(x) 3*x.^4 + 7*x.^3 - 4*x.^2 - 10*x + 1/5; % derivative df = @(x) 12*x.^3 + 21*x.^2...

3 months ago | 0

Answered

Making combinations using random number generators

N=input('give me number of random elements:'); a=input('lower limit of the numbers to generate:'); b=input('upper limit of the...

Making combinations using random number generators

N=input('give me number of random elements:'); a=input('lower limit of the numbers to generate:'); b=input('upper limit of the...

3 months ago | 0

| accepted

Answered

How to create a noisy signal for wavelet transform practice?

maybe this code will help you N=1000; x=linspace(0,2*pi,N); y=sin(x); y2=randn(1,N); y3=y+y2*.1; subplot(2,1,1);plot(x,y)...

How to create a noisy signal for wavelet transform practice?

maybe this code will help you N=1000; x=linspace(0,2*pi,N); y=sin(x); y2=randn(1,N); y3=y+y2*.1; subplot(2,1,1);plot(x,y)...

3 months ago | 1

| accepted

Solved

Given a matrix A return a vector of the product of the elements in each column using a loop without using prod.

--------------------- for m: 3 1 3 3 10 1 9 1 9 4 1 4 5 6 5 ...

3 months ago

Solved

Product of Each Column

Given a matrix |mat| with |n| columns, return a row vector |v| of length |n|, where every element in |v| is the product of the |...

3 months ago

Solved

Replace Nonzero Numbers with 1

Given the matrix x, return the matrix y with non zero elements replaced with 1. Example: Input x = [ 1 2 0 0 0 ...

3 months ago

Answered

Euler's Method

for n = [10, 20, 40, 80, 160] a = 0; b = .5; c = .25; x = linspace(a,b,n);%[a:n+1:b]; f = x.^3; dx = x(...

Euler's Method

for n = [10, 20, 40, 80, 160] a = 0; b = .5; c = .25; x = linspace(a,b,n);%[a:n+1:b]; f = x.^3; dx = x(...

3 months ago | 0

Answered

plotting for cosine wave

I change some lines.... N=45; theta=0:360; % range of values of theta Na1=2*N*cosd(theta); % cosd for cos when you use de...

plotting for cosine wave

I change some lines.... N=45; theta=0:360; % range of values of theta Na1=2*N*cosd(theta); % cosd for cos when you use de...

4 months ago | 0

Answered

Solving a simple integral with input equation from user

syms x str = input('Enter an equation in x: ','s') ; f = function_handle.empty; f = eval(['@(x)', str]); %x = f(); xmin= ...

Solving a simple integral with input equation from user

syms x str = input('Enter an equation in x: ','s') ; f = function_handle.empty; f = eval(['@(x)', str]); %x = f(); xmin= ...

4 months ago | 1

| accepted