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...

4 years ago | 0

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

4 years 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...

4 years 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...

4 years 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)...

4 years ago | 1

| accepted

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(...

4 years 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 years 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 years ago | 1

| accepted

Answered

How do I calculate the coefficients C in this function while P and T are given?

You can use this equations: T=[4:4:24]'; P=[1e-4;2.5e-4;6e-4;1e-3;1.6e-3;2.25e-3]; plot(T,P,'o') n=length(P); A=[ones(n,1) ...

How do I calculate the coefficients C in this function while P and T are given?

You can use this equations: T=[4:4:24]'; P=[1e-4;2.5e-4;6e-4;1e-3;1.6e-3;2.25e-3]; plot(T,P,'o') n=length(P); A=[ones(n,1) ...

4 years ago | 0

| accepted

Answered

How can I find a variation vector of a parameter ?

N=100; a = 355.5+7; b = 355.5-7; r = (b-a).*rand(N,1) + a; figure plot(r) hold on plot([1 N],[a a],'r') plot([1 N],[b b]...

How can I find a variation vector of a parameter ?

N=100; a = 355.5+7; b = 355.5-7; r = (b-a).*rand(N,1) + a; figure plot(r) hold on plot([1 N],[a a],'r') plot([1 N],[b b]...

4 years ago | 0

Answered

Error in sum of matrixes

try this Nplies = 8; thetadt = [90; -45; 45; 0; 0; 45; -45; 90]; t = 0.125; %SI unit, milimeters h = Nplies*t; % Ply engine...

Error in sum of matrixes

try this Nplies = 8; thetadt = [90; -45; 45; 0; 0; 45; -45; 90]; t = 0.125; %SI unit, milimeters h = Nplies*t; % Ply engine...

4 years ago | 0

Answered

How to rearrange multiple results of a function without using for loop?

Assuming that the initial value of k = 1, then it can be avoided using the repmat command as follows (see vector B), N = 11...

How to rearrange multiple results of a function without using for loop?

Assuming that the initial value of k = 1, then it can be avoided using the repmat command as follows (see vector B), N = 11...

4 years ago | 0

| accepted

Answered

How to calculate distance till the next possible stop?

I don't know is correct, parkinglocations = ["Home" "mobile" "ShoppingMall" "mobile" "Workplace" "mobile" "Home"]'; % when "mo...

How to calculate distance till the next possible stop?

I don't know is correct, parkinglocations = ["Home" "mobile" "ShoppingMall" "mobile" "Workplace" "mobile" "Home"]'; % when "mo...

4 years ago | 0

| accepted

Answered

How to plot (n) circles with known center and radius

I don't know is you want this: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% theta=10 % azimuthal distance between the centers of circl...

How to plot (n) circles with known center and radius

I don't know is you want this: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% theta=10 % azimuthal distance between the centers of circl...

4 years ago | 0

Answered

¿Cómo puedo encontrar los indices de un arreglo con valores repetidos con la función find y operadores relacionales?

Yo pienso que si te interesan las posiciones de los valores es mejor poner lo siguiente: n=find((A<4)&(A~=0))

¿Cómo puedo encontrar los indices de un arreglo con valores repetidos con la función find y operadores relacionales?

Yo pienso que si te interesan las posiciones de los valores es mejor poner lo siguiente: n=find((A<4)&(A~=0))

4 years ago | 3

Answered

if greater than in for loop

seven=(seven>100).*(seven-25)+(seven<=100).*seven;

if greater than in for loop

seven=(seven>100).*(seven-25)+(seven<=100).*seven;

4 years ago | 0

Answered

Can someone rearrange the code to run

%subdivisions space /time ht=0.01; Tmax=1.2; nx=33; hx=1/(nx-1); x=[0:hx:1]'; %matrices K=stiff2(1/pi^2,hx,nx); M=mass(1/ht,h...

Can someone rearrange the code to run

%subdivisions space /time ht=0.01; Tmax=1.2; nx=33; hx=1/(nx-1); x=[0:hx:1]'; %matrices K=stiff2(1/pi^2,hx,nx); M=mass(1/ht,h...

4 years ago | 0

| accepted

Answered

3d line plot help

Using this function: function Y = Piecewise(X1,X2) T = linspace(-7.5,17,120); N = length(T); for n = 1:N if X1(n) > 0 ...

3d line plot help

Using this function: function Y = Piecewise(X1,X2) T = linspace(-7.5,17,120); N = length(T); for n = 1:N if X1(n) > 0 ...

4 years ago | 0

Answered

How to Rotate the Ellipses at calculated angle?

%cov is 2x2 covariance matrix that is generated through a long process t = 0:0.1:2*pi; %time axis %Xest is center of ellipse a...

How to Rotate the Ellipses at calculated angle?

%cov is 2x2 covariance matrix that is generated through a long process t = 0:0.1:2*pi; %time axis %Xest is center of ellipse a...

4 years ago | 0

Answered

Function returning matrix instead of vector

f=@(xf,xdata)xf(1)*(xf(4)+((xf(2)-xdata)/(xf(3)/2))).^2./(1+((xf(2)-xdata)/(xf(3)/2)).^2)

Function returning matrix instead of vector

f=@(xf,xdata)xf(1)*(xf(4)+((xf(2)-xdata)/(xf(3)/2))).^2./(1+((xf(2)-xdata)/(xf(3)/2)).^2)

4 years ago | 0

Answered

Missing inputs to distance function

First you need to put you trajectory of the directory, in my case I put this path(path,['/Users/rafaelhernandezwalls/Downloads/...

Missing inputs to distance function

First you need to put you trajectory of the directory, in my case I put this path(path,['/Users/rafaelhernandezwalls/Downloads/...

4 years ago | 0

Answered

Plotting with nested for loops

syms y t=[0 pi 2*pi]; a=[5 10]; for k=1:length(a) for j=1:length(t) f=a(k)*sin(t(j)*y); figure ...

Plotting with nested for loops

syms y t=[0 pi 2*pi]; a=[5 10]; for k=1:length(a) for j=1:length(t) f=a(k)*sin(t(j)*y); figure ...

4 years ago | 0

Answered

Plot solutions to a multi variable system: x + 2y + 3z = 4

if using mesh, and plot3 [y,z]=meshgrid(-4:.1:4,-4:.1:4); x=4-3*z-2*y; mesh(y,z,x) plot3(x,y,z,'o');

Plot solutions to a multi variable system: x + 2y + 3z = 4

if using mesh, and plot3 [y,z]=meshgrid(-4:.1:4,-4:.1:4); x=4-3*z-2*y; mesh(y,z,x) plot3(x,y,z,'o');

4 years ago | 1

| accepted

Answered

How do I get a loop to return all the values that I am looking for at one time?

e=0:200:11000; i=1:length(e) Re=6.37e6; g0=9.80665; g=g0*((Re^2)./((e(i)+Re).^2))

How do I get a loop to return all the values that I am looking for at one time?

e=0:200:11000; i=1:length(e) Re=6.37e6; g0=9.80665; g=g0*((Re^2)./((e(i)+Re).^2))

4 years ago | 1

Answered

Which method is MATLAB use in poly2 to do a curve fitting?

% -- FT is a string or a FITTYPE specifying the model to fit. % % If FT is a string, then it may be: % % FITTYPE ...

Which method is MATLAB use in poly2 to do a curve fitting?

% -- FT is a string or a FITTYPE specifying the model to fit. % % If FT is a string, then it may be: % % FITTYPE ...

4 years ago | 0

Answered

how can I give each subplot a different title?

figure conRR=linspace(1,100,100); conRR(:,2)=sin(conRR(:,1)); conRR(:,3)=sin(conRR(:,1)); conRR(:,4)=sin(conRR(:,1)); conRR...

how can I give each subplot a different title?

figure conRR=linspace(1,100,100); conRR(:,2)=sin(conRR(:,1)); conRR(:,3)=sin(conRR(:,1)); conRR(:,4)=sin(conRR(:,1)); conRR...

4 years ago | 0

Answered

Why is my fundamental frequency at the 15th harmonic order

why don't use the FTTSHIFT, this function Shift zero-frequency component to center of spectrum.

Why is my fundamental frequency at the 15th harmonic order

why don't use the FTTSHIFT, this function Shift zero-frequency component to center of spectrum.

4 years ago | 0

Answered

finding all indices of a value in matrix

A=[2 2 3 ; 2 4 2; 2 3 2]; [r,c]=find(A==min(A))

finding all indices of a value in matrix

A=[2 2 3 ; 2 4 2; 2 3 2]; [r,c]=find(A==min(A))

4 years ago | 0

| accepted

Answered

Array indices must be positive integers or logical values. Error in (line 8) mr(t)=mi-((mi-mf)*(t./tb));

Hi, Yo have 2 errors. First you have the line when you define the vector time: t=linspace(6.5,164,1) % You need to put the n...

Array indices must be positive integers or logical values. Error in (line 8) mr(t)=mi-((mi-mf)*(t./tb));

Hi, Yo have 2 errors. First you have the line when you define the vector time: t=linspace(6.5,164,1) % You need to put the n...

5 years ago | 1