Index exceeds array dimensions. Index value 150002 exceeds valid range [1-150001] for array 'v'.
for n = 1:length(t)-1; Error shows clearly that vector _v_ has 1 additional element. Change the loop as above since v(n+1) ...

1 month ago | 0

| accepted

Plot power spectrum from FFT
power = abs(y).^2/(fs*n); % power of the DFT plot(f,power) Divide with _fs_ sampling frequency and plot it

1 month ago | 0

I want to contour plot the data as shown in attached figure from my equation. I am not able to get the gaussian type behavior. What's wrong with my code?
h_t=linspace(100,500,100); r=linspace(-100,100,500); [H,R]=meshgrid(h_t,r); Rho_m=Ib.*(Rho./(H)).^2.*exp(-(2*R.^2./(H))); %...

1 month ago | 0

| accepted

Zeros error when entering matrix data
roomLength=zeros(1,(numberRooms(i))); roomWidth=zeros(1,(numberRooms(i))); Give the size of _numberRooms_

1 month ago | 0

| accepted

find the coefficients a, b, and c of the quadratic polynomial. that passes through the three points (x, y)
syms a b c x = [1 4 5]; y = [4 73 120]; eqn = y == a*x.^2+b*x+c sol = solve(eqn,[a b c])

1 month ago | 0

i have 300 sheets in one worksheet in excel. i wan to import this to matlab. I want to create loop where it reads all sheets and plot graph on a same graph.
hold all for I = 1:length(num) AOA(:,I) = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\windtunnel.xlsx',num2str(I),'A7:...

1 month ago | 0

| accepted

Plot summation series | For Loop | Creep Strain
clear all;clc %% Linear Creep Example s=100; % constant tensile stress, (MPa) t=linspace(0,10000,11); % duration of applied ...

1 month ago | 0

| accepted

finite difference method scheme
clc clear all %%%%%%%%%%%%%%% Inputs r_in=1; % Inside Radius of polar coordinates, r_in, say 1 m r_out = 2; % Outside Radin...

1 month ago | 1

| accepted

Changing the variable used in a loop
tube_inner_R = 0.003 tube_L=[12.14 6.46 9.84 8.17]; % put them in vector for inst = 1:4 tube_V(inst)=pi*tu...

1 month ago | 0

| accepted

what is wrong with my calculation?
syms rs xs rp xp [xs,xp]=solve(rs*rp^2./(rs^2+(xs+xp)^2)==rp, xp*rs^2+xs^2*xp+xs*xp^2==0,[xs, xp])

1 month ago | 0

| accepted

Array after nmz function to create a bar graph
array=[quiescence; walking; eating; climbin; mating] % use []

1 month ago | 0

| accepted

a run function gives an error due to size
resultt(bi,bj) = birfazson(1,birfazson(2,:) == 1); Ok. Check by removing transpose at the end

1 month ago | 0

What is this line of code doing?
Checking the value of *blob(i,j-1))* in _blob_ matrix and replacing it with this value *blob(i-1,j)*.

1 month ago | 0

Ask user for 3 equations and solve ODE
% solve u'(t) = F(t,u(t)) where u = [u1(t), u2(t), u3(t)]' % using forward euler method % Initial conditions and setup neqn...

2 months ago | 0

Graph are not following the if statement
Modify this part of code and check for k = 1:length(nDp) if nDp(k) > 100 nDp(k) = 100; else nDp(k) = (Lc*Vt(k))/...

2 months ago | 0

| accepted

Plotting error "Vectors must be the same length"
t(n+1)=t(n)+DeltaT; Change this line to above

2 months ago | 0

| accepted

Matrix calculation(replacing a new value instead of matrix element)
a1=7; a2=12; a3=4; w1=min([a1,a2,a3]); format shortG f1=double(a1-w1) f2=double(a2-w1) f3=double(a3-w1) %%%%%%%%%%%%%%%%...

2 months ago | 1

Probability calculation for Bernoulli trials.
function P = bn_atleast(p,N,k) rename the first line of bn_atleast to above

2 months ago | 0

converting date and time string to datetime object
k = 1; while k<=length(Ionotable.x_Time) x = (Ionotable.x_Time(k)) %x_Time is the column where the date and tie values...

2 months ago | 0

| accepted

Having errors in a multivariable for loop.
temp_int=24; temp_ext=10; U=5; hi=4; h=1:5; temp_diff=(U/hi)*(temp_int-temp_ext); I = 0:0.1:2.5; x = 0:0.1:2.5; n=...

2 months ago | 1

| accepted

Multiple sine periods with a specific fundamental frequency
%%Time specifications: f = 100; %fundamental frequenxy Fs = 20*f; % samples per se...

2 months ago | 0

need to use this analytical solution to plot the absolute percent error in the concentration A at each time step for Euler's method
nsteps = 12; t = zeros (nsteps,1); A = zeros (nsteps,1); B = zeros(nsteps, 1); P = zeros(nsteps,1); A(1) = 1; B(1) = 3; C...

2 months ago | 0

Finite Difference Centre Time Centre Space
%Set up plots to solve linear advection equation using a CTCS scheme u = 2.0; %Set constant velocity value nx=51; %Number of G...

2 months ago | 0

I keep getting an error. Help
tspan = [0:0.05: 8]; y = [0.4; 0]; [t , y]= ode45(@odefun, tspan, y); plot (t, y(:, 1)); xlabel ('t'); ylabel ('y(1'); tit...

2 months ago | 0

How to give a piecewise function as input
clear all clc syms t s y(t) Y dy(t)=diff(y(t)); d2y(t)=diff(y(t),2); F = [-1 1 16]; %input('Input the coefficients [a,b,c]:...

2 months ago | 0

my plot for current vs speed of an energy efficient vs standard efficiency induction machine is not showing any values
clear s=0.0005:0.0005:1; %Slip [pu] f = 50; p = 4; ns=120*f/p; n=(1-s)*ns; R1=1.1; X1 = 0.2; Xm = 1e-3; R2 = 3.4; X2...

2 months ago | 0

Peltier Device not cooling
T_A = a1+b1*dt; % a1, a2 b1 b2 are some coefficients in your model. T_B = a2 +b2*dt; dt = 0:0.1:100; % time vector for k = ...

2 months ago | 0

My Fourier Series plotter isn't outputting correct y-values
plot(yfit(1:Ts:end)) % plot your fourierseries It seems you have already computed the fourier series, To visualize the smooth...

2 months ago | 0