Community Profile # VBBV

### PEC

Last seen: Today Active since 2017

Programming in MATLAB applied to interdisciplinary engineering fields

#### Statistics

All
• • • • • • • • • • • • #### Content Feed

View by

SWITCH expression must be a scalar or a character vector. Error in pathplaninglaila (line 17) switch mode
The mode variable used for the switch expression needs a character data type. you need to convert that variable to char mode as...

1 day ago | 0

Give me an example of a calling function.
Put the prog2 code in a function file (which returns the value of n) and call that function in prog1 script file as shown below ...

2 days ago | 0

Replace strings with a different string and save the data
D = readtable('data.txt'); C = char(['40% Fe';'30% Al']) % e.g. element data to be filled in 1st column D.(1) = repmat(C,168/2...

2 days ago | 0

Operator '>' is not supported for operands of type 'cell'.
T is a table array/datatype, and you try to access variable inside the table with same name , this is not valid operation idx =...

3 days ago | 0

how to extract roots of equation
syms w N k1=70; k2=200; m1=0.1; m2=0.064; m3=0.04; r=0.25 M1=(m2+m3)/m1; M2=m2/m1; K=k2/k1; wn1=(sqrt(k1/m1))/(2*...

3 days ago | 0

solving beam deflection curve
if you use linspace function, it divides the length between initial and final points into non-equispaced values, however if you...

6 days ago | 0

Save file .txt the same name as loaded file

6 days ago | 0

Finding a definite integral
u and k are both functions of x. But I only know the values of u and k at some points of x. you can interpolate missing values ...

6 days ago | 0

MATLAB does not print vector file even with renderer specified
how about image format ? print('-image','a1.eps','-depsc')

7 days ago | 0

Adding zeros to a column vector to match a larger column vector
x = rand(100,1) % column vector y = rand(108,1) % another column vector of different size zeros(1,length(y)-length(x)) % row ...

7 days ago | 0

Numerical Differentiation using Finite Differences
h = 0.01; X = 0:h:2*pi; fx = sin(X); df1 = (sin(X+h) - sin(X))/h; df2 = (sin(X) - sin(X-h))/h; df3 = (sin(X+h) - sin(...

7 days ago | 1

why I get the error message like "Attempt to execute SCRIPT bar as a function"?

7 days ago | 0

Inputting a Matrix into a function
t0 = 0.5235; t1d = 0:60; t1r = deg2rad(t1d);% use this function to convert to radians phi = pi; g = cos(t0)*cos(t1r) + sin(t...

8 days ago | 0

Symbolic toolbox differentiation by chain rule without expression defined
syms x(t) y(t) z(x,y) t x = x(t); y = y(t); z = z(x,y) C = diff(z,t)

8 days ago | 0

| accepted

How to count number of terms in a symbolic expression?
syms x y z='x*y+cos(x*y)*x+x*sin(x)+sin(x)*cos(x)-x-y+2' C = strsplit(z,{'+','-'}) length(C) C{3} % 3rd term

9 days ago | 0

What command do i need after de hold off fuction to print the labels in my plot?
print('-image','-dpng', 'windclimate_allyears.png') Try using the OpenGL graphics rendering format as above. The version of Mat...

9 days ago | 0

How do I optimize graph size?
May be the change in coefficient for cosine function plotted in black color as shown below z = -72:0.2:72; hold on Tb = 543.4...

21 days ago | 1

| accepted

I am trying to plot a series, with multiple variables.
clc; % Define parameters T_sub_1 = 100; H = 2; L=1; syms n % Create meshgrid x=linspace(0,2,20); y=linspace(0,4,20);...

21 days ago | 0

Matlab symbolic : calculate expression with vector of symbolic variables
Use the element wise operator for / and ^ ... i.e. ./ and .^ as below clear syms l_min l_max fsky Np var1D var2D varO1...

23 days ago | 0

while loop running forever during attempt at Newton Rhapson method
d=0.007; dI=1.219; Rfi=1.76*(10^(-4)); Rf0=Rfi; hs=356; ht=hs; kw=60; dTm=29.6; Q=801368; Aex=64.15; a=((1/ht)+Rfi)/dI...

23 days ago | 0

| accepted

Need to solve Fourier Series script
if you have the entire code in one script file, then you can put all the functions after the plot function call as below otherwi...

23 days ago | 0

Correlation Coefficient in Legend
Use the sprintf command in legend function just like the text, and include a higher precision specifier for decimals e.g,. 5...

1 month ago | 0

can't plot
syms p1 ap2 ap3 ap4 th1 = 0; ap1 = 0; a1 = 0; b1 = 0.5; c1 = 0; R1z = [ cos(p1), -sin(p1),0, 0; sin(p1), cos(p1), 0, ...

1 month ago | 0

why is this code not running?
plot(TimeValue, Pdispatch(:, 1), 'Color','r', 'LineWidth', 2);

4 months ago | 0

Error: variable might be used before it is defined.
Change this line yy2 = Pr*(y(4)*y(2)-y(1)*y(5)-Df*yy3-Nb*y(5)*y(7)-Nt*y(5)^2) to yy2 = Pr*(y(4)*y(2)-y(1)*y(5)-Df*y(3)-Nb*y...

4 months ago | 0

Why am I getting the error "Array indices must be positive integers or logical values" in MATPOWER?
The problem is with nested matrices bs or n2i matrices. % brs = ( mpc.branch(:, BR_STATUS) & ... %% branch status % ...

4 months ago | 0

Conversion of symbolic expression to double without obtaining complex numbers
oneway, is to use a conditional statement for negative input values through abs function. But if you want to avoid complex va...

4 months ago | 0

argument suggestion with shared argument validator
function s = fun3(a) arguments a {mustBeMember(a,@dummyClass)} = "a" end ...

4 months ago | 0