# VBBV

### PEC

Programming in MATLAB applied to interdisciplinary engineering fields

**Statistics**

RANK**77**

of 264.940

REPUTATION**1.724**

CONTRIBUTIONS

**24** Questions

**482** Answers

ANSWER ACCEPTANCE **
87.5%
**

VOTES RECEIVED**138**

RANK**4.861** of 18.100

REPUTATION**245**

AVERAGE RATING**3.00**

CONTRIBUTIONS**12** Files

DOWNLOADS **32**

ALL TIME DOWNLOADS**2357**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

Why is my loop not working? "Index exceeds array bounds"

%%%%%% DEFINITIONS %%%%%%% clear Q_lpm=15; Q(1) =(Q_lpm/1000)/60; %m3/s [INPUT] diameter = 0.01; % m [INPUT] t =0.01; % tim...

circa 18 ore ago | 0

interpolate (extrapolate?) the values in between two matrices using existing data

A = [1, 2, 3, 4, 5; 0.3654, 0.3634, 0.3663, 0.3665, 0.3677]; B = [16, 17, 18, 19, 20; 0.4653, 0.4636, 0.4652, 0.4620, 0.4715];...

3 giorni ago | 0

| accepted

I'm definitely doing the exponential distribution wrong, am I?

N = 1e4; a=0; b=1; x = (a+(b-a)*rand([N,1])); lambda = 11; % try with different lambda values Y = -log(x)/lambda; figure...

5 giorni ago | 0

speed up the for and if loop

for i = 1:10:300 % use step increments for j = 1:10:500 for k = 1:1000:17000 if(temp(i,:) > 2) ...

9 giorni ago | 0

ode45 keeps giving me the error shown below.

a = 0.459; lambda1 = 1.11*10^(-2); %units min^-1 lambda2 = 1.38*10^(-4); %units min^-1 Cp0 = 100; %units nM t = 0:7200; %uni...

9 giorni ago | 0

| accepted

ODE with Newton method

clear all close all n=1001 y0=1; xmin=0; xmax=10; x=linspace(xmin,xmax,n); %grid step=(xmax-xmin)/n; %Step Size yy=zer...

10 giorni ago | 0

Function output an array

in = [rand(1,15);rand(1,15)]; differences(in) function [out] = differences(in) %This function allows an array input and th...

27 giorni ago | 0

During simulation of mathematical model occuring following error

Use limit output option for selecting integrator saturation limits. May be in your case, its running indefinitely.

28 giorni ago | 0

Using function with a for loop

(factorial(i)).^2) You have two extra parenthesis for this term

29 giorni ago | 0

| accepted

Index location of certain dates with find and a loop

locs= zeros(length(TargetDates),length(t_list)); % change preallocated array size Change the preAllocated size of locs locs...

circa un mese ago | 0

why my code is running so slowly in the while loop

clc; clear all; close all; r = 1250; O = [2500 2500] Px = 2500; Py = 1000; P = [ Px Py ]; Va = 100; To = 4; q22 = 0.1 ...

circa un mese ago | 0

Summation of all odd numbers from 1 to 451

n = 451; a = 1; d = 2; S = 0; % Compute S by adding the terms for i = 1:n S(i) = (a+(i-1)*d/2); end sum(S(1:2:end)) ...

circa un mese ago | 1

Implementation of Integral Cost function in Matlab

tspan = [0,1]; x0 = 1; u = 0.1; tau = 1; xn = 1; % noise [time, dxdt, J] = plant_dynamics(tspan,x0,u, tau, xn); subplot...

circa un mese ago | 0

| accepted

Problem with filling a variable inside loops

p = readtable ('pnts.txt'); p = table2array(p); x_p=p(:,2); y_p=p(:,3); z_p=p(:,4); t_p=p(:,5); xedges=-100:10:100;...

circa 2 mesi ago | 0

| accepted

Numerical solution of PDE with uniform initial condition

clear all clc %% pts = 2^0.1; tmax = 1.76; ti = linspace(0,tmax,50); % give suitable sample size xi = linspace(0,1,50); ...

circa 2 mesi ago | 1

| accepted

Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters. Can anyone help in this error?

M = 1:10; R = 200:300; Mean = mean(M); Range = mean(R) d = 2.326; n = 5; SE = Range./(d*sqrt(n)) % check the parenthesis ...

circa 2 mesi ago | 0

Iterations outcome summation (accumulation).

x = [4 7 9 11 6 8 13 5 0 2 1 23;14 3 8 0 2 9 7 2 12 17 4 5;0 1 3 4 0 0 7 8 2 5 4 1]; d = 0; iter = 1; for k = 1:size(x,1) fo...

circa 2 mesi ago | 0

| accepted

Arrays have incompatible sizes for this operation.

LeqPrevious = zeros(1,30,2); % array preallocation is not the sme size of Leq LeqPrevious = Leq(i,:,:); % inside the loop Leq...

circa 2 mesi ago | 0

Solve System of ODEs with Multiple values of a parameter using vectorization but not looping.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...

circa 2 mesi ago | 0

| accepted

Legend Producing Wrong Colour Lines

x=-5:0.1:5; freal=x.*exp(-x); ftaylor0= 1./exp(x); % they is scalar in your code ftaylor1= 1./exp(-x); % this is scalar in ...

circa 2 mesi ago | 0

I've tried to make a simulation with matlab but it can't work. especially for the function commands that I have described. I'm not good at matlab. can you help me to check the

clc;clear all;format long; y = [1000 0 0 2000 0]'; [T y]=ode45(@fgliom,[0 200],[10000 0 0 2000 0]',10^-7); [T0 y0]=ode45(@f...

circa 2 mesi ago | 0

When plotting ROC curve; test_labels=double(nominal(imdsTest.Labels)); I am getting an error as " Unrecognized function or variable 'nominal' .

test_labels = nominal(imdsTest.Labels); double(test_labels) % try this If you have defined function named nominal in your p...

2 mesi ago | 0

| accepted

regexp shows an error while reading a space in text file.

ss = 'PORT 12 P=2 Z=50 PIN_ID=CB7TX' [port_tokens2,port_match3] = regexp(ss,'PORT\s+(\d+)\s+(\w+=\d)+\s+\w+=\d+\s+(\w*=\w*)',...

2 mesi ago | 1

| accepted

Error: The length of the segments cannot be greater than the length of the input signal.

fft_point = [2048 4096]; fft_point must have atleast 2 values as input argument for _pwelch_ function

2 mesi ago | 1

Too many input arguments

p = [3 -2 -4]; TESTE(p) ;% give the input argument matrix p for the function TESTE in command window function r = TESTE(p) ...

2 mesi ago | 0

Not enough input arguments in Matlab R2021b

Ke = randi(4,4); % assume this as FE stiffness matrix to be added gdl_bar = [2 2 4 4]; % no of DOF for each element in stiffn...

2 mesi ago | 0

| accepted

Something wrong with the produce output plots

%calculates the result of a 1km drag race for %a user define vehicle powered by an internal %combustion engine %2020 Porsche ...

2 mesi ago | 2

| accepted

Hi, I keep getting y as a 3x3 matrix, but its supposed to come out as a 3x1 matrix. Could someone please find my mistake. I think Im missing a matrix decimal divide or multipl

% Take home problem 2 % Water (1), Acetone (2), Methanol (3) R = 83.14; % bar cm^3 mol^-1 K^-1 P = 2; %bars x = [0.35; 0.25;...

2 mesi ago | 0

| accepted

WHEN I AM RUNNING THIS CODE I AM GETTING FOLLOWING ERROR

u = rand(1,5) % assume a matrix values [p,s]= perdecomp(u) % call the function giving input matrix u function [p,s] = perde...

2 mesi ago | 0

| accepted

combining 5 rows into one matrix

mat1=1:10; mat2=11:20; mat3=21:30; mat4=31:40; mat5=41:50; % transpose is not required to make 5x10 newMat = [mat1; mat...

2 mesi ago | 0