Risposto
Convert cartesian coordinates to polar coordinates
Edit your file - you did not declare it as a function, so Matlab uses it as a script. Also think about to vectorize your code, t...

oltre 5 anni fa | 2

| accettato

Risposto
Creating a symbolic array
>> q = sym('q', [5, 5]) q = [ q1_1, q1_2, q1_3, q1_4, q1_5] [ q2_1, q2_2, q2_3, q2_4, q2_5] [ q3_1, q3_2, q3_3, q3_4...

oltre 5 anni fa | 0

Risposto
I'm getting an error "Undefined function 'Romberg' for input arguments of type 'char'." I'm trying to code the romberg integration method.
For me it worked: a = 0; b = pi; nmax = 3; fun ='sin (x)' ; [t, r]= Romberg (fun, a, b, nmax) function[t , r] = Romberg...

oltre 5 anni fa | 0

Risposto
Is it possible to solve the equation for x?
syms x a(1) = 0.89; a(2) = 6.7; a(3) = 26.12; a(4) = 0.07; a(5) = 78.05; a(6) = 34.01; a(7) = 0.33; a(8) = 22.49; a(9) ...

oltre 5 anni fa | 0

Risposto
Fill a vector with two vectors
V1 = [3 8 6 7] V2 = [1 5 9 4] V = reshape([V1;V2],1,[]) V = V(3:end) results in: V1 = 3 8 6 7 V2 =...

oltre 5 anni fa | 1

| accettato

Risposto
Trying to plot this curve what have I done wrong?
fun = @(x)(18*sqrt(2)*(sqrt(1+1./(1+x.^2)) + asin(1./(1+x.^2)-pi/2))) fplot(fun)

oltre 5 anni fa | 0

Risposto
How to find the solution of inverse function ?
x = [1 2 3 4 5 6 7]; y = [3.6 1.8 1.2 0.9 0.72 1.5 0.51429]; p = polyfit(x,y,2) syms x fx(x) = poly2sym(p) gx(x) = finvers...

oltre 5 anni fa | 0

| accettato

Risposto
Possible combinations for a vector
You could use allcomb from FEX: k = 0:2; coms = allcomb(k,k,k,k,k,k,k,k,k); as expected there are 3^9 = 19683 results

oltre 5 anni fa | 1

| accettato

Risposto
how do i write a matlab script to sum this expression?
Symbolic: syms n positive integer N = 10000; eq = 1/n + 1/((n+2)*(n+3)); pretty(eq) sol = symsum(eq,n,1,N) sol_num = doubl...

oltre 5 anni fa | 1

Risposto
ODE Function time output
Use events: Z0 = 6; Zt=0.05*6; tspan = [0 24]; opts = odeset('Events',@(tZ,Z)EventsFcn(tZ,Z,Zt)); [tZ,Z,tZe,Ze,iZe] = ode45...

oltre 5 anni fa | 0

| accettato

Risposto
Why isn't my code graph anything.
Try: %create a cater plot clear all; %x = [20,30,40,50] x = [-3,-1,1,2] y = [8,23,28,34] y=[8,23,28,34].' colum = [...

oltre 5 anni fa | 0

Risposto
How find symbolic solution matlab
It appears that there either is no symbolic solution or Matlab is not powerful enough to find one. For sin(t) it would work. How...

oltre 5 anni fa | 1

Risposto
ode 45 and for loop
k = 0; T_sol = cell(1,100); X_sol = cell(1,100); for ii = 0.1:0.1:10 k = k+1; [T,X] = ode45(@(t,x)fx(t,x,ii), [0 ...

oltre 5 anni fa | 0

| accettato

Risposto
Graph Plotting the differential equation
yyaxis left fplot(qSol,[0, 100]) yyaxis right fplot(TSol,[0, 100])

oltre 5 anni fa | 1

| accettato

Risposto
Defining function file of ODE function
C0 = 5; tspan = [0 10]; [t,C] = ode45(@Conc,tspan,C0); plot(t,C) function dCdt=Conc(t,C) k1=0.7; Vo=1; Q=Vo; Cin=200; ...

oltre 5 anni fa | 1

| accettato

Risposto
How do i plot this quadratic graph?
x = -10:10; y = polyval([1 -2 -4],x); plot(x,y) r = roots([1 -2 -4]) text(r(1),0,'\leftarrow Root') text(r(2),0,'\leftarrow...

oltre 5 anni fa | 0

Risposto
Solve a Matrix equation
Symbolic approach: A = sym('A', [4,1]) B = magic(4) P = 13 sol = solve(A'*B*A==P, A) sol.A1 sol.A2 sol.A3 sol.A4 % This...

oltre 5 anni fa | 0

Risposto
Suppose that at any given time t (in seconds) the current i (in amperes) in an alternating current circuit is i = 2 cos t + 2 sin t. What is the peak current for this circuit (largest magnitude)?
Do the same as shown in your question before. Then use diff(...) == 0 to find extremum points. The solve function maybe helpfu...

oltre 5 anni fa | 1

| accettato

Risposto
unable to find symbolic solution
1. The condition for the second ode is invalid - i assume you meant: cond = T(R)==T0; instead of cond = q(R)==T0; 2. As...

oltre 5 anni fa | 1

| accettato

Risposto
Find intersection point between u(t) = t^2(t-1) and u = 10.
Simply use the function you calculated: >> t_sol = vpasolve(uSol == 10,t) ans = ...

oltre 5 anni fa | 1

| accettato

Risposto
Error using evalin Undefined function or variable 'x'. Error in sym/eval (line 11) s = evalin('caller',vectorize(map2mat(char(x))));
clear AC=0.15; BC=0.2; AD=0.35; xA=0; yA=0; rA=[xA yA 0]; xC=AC; yC=0; rC=[xC yC 0]; syms xBsol yBsol ii=0; for ph...

oltre 5 anni fa | 1

| accettato

Risposto
find the equation of tangent to the curve y=2(x^1/2) at (1,2)
https://de.mathworks.com/help/symbolic/syms.html#buoeaym-1 https://de.mathworks.com/help/symbolic/diff.html

oltre 5 anni fa | 1

| accettato

Risposto
How to find the solution for the system of equations
Your system is inconstistent and therefore there is no solution: % x is shorter than lambda x = sym('x', [14 1]) ; % system...

oltre 5 anni fa | 0

| accettato

Risposto
How can I delete even rows in a matlab Matrix
>> A = [1 2 3; 4 5 6; 7 8 9; 0 -1 -2] A = 1 2 3 4 5 6 7 8 9 0 -1 -2 ...

oltre 5 anni fa | 0

| accettato

Risposto
ode45 Two Variable Differential equation Problem - Too many inputs error
Fixed the input in your functin. Rising t>7 gives warning, since the problem appears to be stiff: %% Initial Conditions: % Ini...

oltre 5 anni fa | 0

| accettato

Risposto
Graphing using Matlab. How would you graph a function using matlab?
a = 24; b = 4.8; ii = 0:20; y = a + b.*ii; plot(ii,y)

oltre 5 anni fa | 0

Risposto
Please explain what this error is...
Your function has to be called with 2 inputs a and b for example when a=2 and b=5: [res1, res2, res3] = MyFun(2, 5)

quasi 6 anni fa | 0

Risposto
Can anyone help me fix that error please
You missed to define several variables, which are used in your equations: % several used variables are not defined! - i set the...

quasi 6 anni fa | 0

Risposto
fsolve with one variabel
Tinc = 5+273; Tinv = 45+273; mv = 1000; Cpv = 4180; A = 0.032*(21-2); h = 20; U = ...

quasi 6 anni fa | 2

Risposto
Find the value which causes an error from a vector
This works with logical indexing, therefore avoids the if / else logic and should ensure that you do not need any error messages...

quasi 6 anni fa | 0

Carica altro