# VBBV

### PEC

Programming in MATLAB applied to interdisciplinary engineering fields

**Statistics**

RANK**79**

of 262,593

REPUTATION**1,692**

CONTRIBUTIONS

**24** Questions

**876** Answers

ANSWER ACCEPTANCE **
87.5%
**

VOTES RECEIVED**150**

RANK**4,958** of 17,976

REPUTATION**237**

AVERAGE RATING**3.00**

CONTRIBUTIONS**12** Files

DOWNLOADS **35**

ALL TIME DOWNLOADS**2322**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

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

4 days ago | 0

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

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

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

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

9 days ago | 0

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

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

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

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

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

15 days 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*)',...

15 days 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

15 days 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) ...

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

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

18 days 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;...

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

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

21 days ago | 0

is the "for loop" is wrong? what can be the solution?

clc ti = 0; tf = 100E-4; tspan=[ti tf]; o = 1E6; tc = 70E-9; tf = 240E-6; a1 = 0.02; a2 = 0.02; P1 = 1; P2 = 1; ...

21 days ago | 0

| accepted

what the problem that I get to during plotting the graph

ti = 0; tf = 10E-4; tspan=[ti tf]; y0=[2;2;1;1;1].*10E-2; % this change [T,Y]= ode45(@(t,y) rate_eq(t,y),tspan,y0); plot(...

30 days ago | 0

All I think is to get a sine wave function when plotting T vs A(1), but I didn't get any output. help me to modify this program

format short a = 0; b = 4; h = 0.1; V =1E-5; I1 = 0.2; I2 = 0.8; o = 3.5; % what is this variable ? tc = 3.0; % tf = ...

1 month ago | 0

| accepted

plot numbers with gap

clc clear close all; T=[1.96E-5, 2.18E-5, 6.09E-4, 6.04E-4, 6.11E-4]; S=[1.94E-5, 1.96E-5, 1.98E-5, 2.06E-5, 1.49E-4...

2 months ago | 0

How do I specify range for my x axis using the plot function

x = linspace(-2*pi,6*pi); %give those values here y = cos(x); plot(x,y)

2 months ago | 0

How to plot three different graphs in same window using subplots , animated line and adpoints . I have submitted my code in text box please help to run this three graphs

clc; close all; t = -3:0.01:3; x=@(t) exp(-t).*(t>0)+ 0.5*(t==0); xa=x(t); xe=( x(t)+x(-t))/2; x0=(x(t)-x(-t))/2; subplot(...

2 months ago | 0

For loop not working

A = rand(2,4) for i=1:length(A) % using a single value B(:,i) = A(:,i)./sum(A(:,i)); % divide each element with sum of that...

2 months ago | 0

| accepted

Write Standard Deviation Distance

v = [10 12 14]; x = [7 7 7]; % length of x vector (weights) for each element and to be same as vector v dist = standard_deviat...

2 months ago | 0

How to plot square root of a function?

x1 = 0:0.01:10; % check with small intervals y = sqrt(1-(x1).^2); plot(x1,real(y)); ylim([-1 1.5]) If you use small inter...

2 months ago | 0

| accepted

How can i run correctly my Backward Difference Formula code ?

%% Backward Difference Formula Method %% clc; clear all; h=0.01; t=0:h:1; n=numel(t); mu = [20 -20] hold all for k = 1:le...

2 months ago | 0

dN/dt = s + ( g*N*T^2) /(h + T^2) - ( C *T - p*D -q*L) *N - (z*M*N) -( e*N)

f = @(T,N) (s+ ((g*N*T^2)/(h+T^2)) - ...) % change small case t to Upper case T and try f is function of T and N and not small...

2 months ago | 0

| accepted

Error using / Arguments must be numeric, char, or logical.

y=@(t) 2.718.^(-t/5)-(2.718.^(-t/5).*t)/5; t=0:1:10; plot(t,y(t)) Define the equation as anonymous function and plot

3 months ago | 0

Bar plot with two x axis and Display Groups of Bars

x = 2010:2019; y = rand(1,10); % 1 y6= rand(1,10); % 2 yyaxis left %ax = gca; %ax.YAxis.Exponent = 2; b = bar(x,[y;y6]);...

3 months ago | 0