Beantwortet
Shadow on xy plane of line in plot3?
use surfc function but you need a grid in x and y directions

etwa 4 Jahre vor | 0

Beantwortet
Least squares regression to find coefficients
one solution is: [length(x) sum(x); sum(x) sum(x.^2)]\[sum(y) ; sum(x.*y)]

etwa 4 Jahre vor | 0

Beantwortet
How to plot this eqaution
t=0:.001:1.0; s4 = cos(80*pi*t-10*pi).*(t>0.5 && t<=1.0);

etwa 4 Jahre vor | 1

| akzeptiert

Beantwortet
how can we solve non-linear equations like this via MATLAB, I am trying to solve it by using following program but it shows error, shown below in the pic? Thanks in advance.
eqns = [2*u + v == 0, u - v == 1]; S = solve(eqns,[u v]) clear syms a1 a2 a3 a4 eqn1 = cos(a1)+cos(a2)+ cos(a3)+ cos(a4) ==3...

etwa 4 Jahre vor | 0

Beantwortet
Why is there a difference in the error when using "syms approach" and "@(x) approach" while defining functions in MATLAB?
Method 2 is an approximate method for finding the derivative of a function

etwa 4 Jahre vor | 0

Beantwortet
Writing data into a text file - fprintf
You should use variables like ReactionTime as global Use this code after the function definition: global ReactionTime cd Use ...

etwa 4 Jahre vor | 0

Beantwortet
How to generate a matrix with assigned probability?
% x is the probability of 1 % m rows and n columns A=binornd(1,x,n,m)'; % another random matrix A=binornd(1,x,n,m)';

etwa 4 Jahre vor | 1

Beantwortet
Index from one vector to different sized vector
% v1 the first vector % v2 the matrix [~, ~, i2] = intersect(v1, v2(:,1)); newMatrix = v2(t2,:);

etwa 4 Jahre vor | 0

Beantwortet
Roll a 6-sided die until you have rolled a total of 25 6's.
find(cumsum(randi(6,1,1000)==6)==25,1)

etwa 4 Jahre vor | 0

Beantwortet
calling a function in a different script.
One solution is that you can use this command at the top of the files that use 'r' global r; Just after function definition...

etwa 4 Jahre vor | 0

Beantwortet
Why does my code output answers in log?
Use double(solve([1000000==300*((((1+0.08/12)^(n+1)/(0.08/12)-1)))])) to solve this financial problem (interest rate)

etwa 4 Jahre vor | 1

| akzeptiert

Beantwortet
How to return an array to single value?
The size of x is different from G and Tamb

etwa 4 Jahre vor | 0

Beantwortet
Plotting functions using loop
lambda=1; gamma1=0.3; n=0:1:15; P1 = (lambda.^n)./(lambda+gamma1).^(n+1)); plot(n, P1);

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
Negative indexing of an array
There is no non-positive indexing in Matlab. you can use x(end) for the last member, x(end-1) the member before the last membe...

etwa 4 Jahre vor | 0

Beantwortet
How i can write this in matlab in optimized form using intermediate variables????
sy = sin(y); asy = abs(sy); xt = x + tan(y); xtn = x + log(abs(tan(y))); tx = 2*x+sy^2; ot =1/3; R1 = abs(x)*xt/(50*x^2+as...

etwa 4 Jahre vor | 0

Beantwortet
How i can write this in matlab??? x=-1.75*10^-3; y=3.1*pi;
R1 = abs(x).*(x+tan(y))./(50*x.^2+abs(sin(y))).^(1/3)+(5*x.^2+abs(sin(y))).^2.2./(x.^2 .* (x+tan(y)).^4); R2 = sinh(sqrt(2*x+(s...

etwa 4 Jahre vor | 1

| akzeptiert

Beantwortet
Number of odd numbers in an array
function n = myNOdds(x) n = sum(mod(x,2)==1); end

etwa 4 Jahre vor | 1

| akzeptiert

Beantwortet
Output of a for loop
You can use this code: %%Acting Forces on the beam and position F2=(-4); x2=0.4; L=1; %Constant EI Assumed 100 kN.m^2 (fr...

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
I'm trying to get a vector from a loop without doing the linspace function
vector = zeros(1,5); j = 1; for i = 0:1.25:5; vector(j) = i; j = j+ 1; end disp(vector)

etwa 4 Jahre vor | 0

Beantwortet
Graph line not showing
Several issues in your code: 1- it has only one point (use plot(x, y) ) 2- The angle should be in radians not degrees. For ang...

etwa 4 Jahre vor | 0

Beantwortet
How do I write the following in matlab ?
H1 = (x.*(1+x.^2).*(1+2*x).^2).^2.3 ./ log(abs(cot(y))) + (log(abs(cot(y)))-x) ./(x.*(1+x.^2).*(1+2*x).^2); R2 = sinh(sqrt(2*x+...

etwa 4 Jahre vor | 0

Beantwortet
Can you help me write the following in matlab ?
H1 = (x*(1+x^2)*(1+2*x)^2)^2.3 / -log(abs(tan(y))) + (-log(abs(tan(y)))-x) /(x*(1+x^2)*(1+2*x)^2); R2 = sinh(sqrt(2*x+(sin(y)^2...

etwa 4 Jahre vor | 0

Beantwortet
How do I write the following in matlab ?
H1 = (x*(1+x^2)*(1+2*x)^2)^2.3 / -log(abs(tan(y))) + (-log(abs(tan(y)))-x) /(x*(1+x^2)*(1+2*x)^2); R2 = sinh(sqrt(2*x+(sin(y)^2...

etwa 4 Jahre vor | 0

Beantwortet
Plot only equilateral triangles
figure, hold on e = 0.01; i=0; while i<= 10 x = rand(3,1); y = rand(3,1); c = rand(3,1); L1 = sqrt((x(2)-...

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
Plot only equilateral triangles
figure, hold on e = 0.0001; i=0; while i<= 10 x = rand(3,1); y = rand(3,1); c =rand(3,1); L1 = sqrt((x(2)...

etwa 4 Jahre vor | 0

Beantwortet
How to enter multiple values for a single input in a function
Most Matlab functions are vector based. you should use .^ for vector based ^ and .* for vector based * So you function line loo...

etwa 4 Jahre vor | 0

Beantwortet
how do i store a variable out of my function?
The first line should be function x = create_array(N,M,row_orient) to return the generated matrix

etwa 4 Jahre vor | 1

| akzeptiert

Beantwortet
generalized eignvalues/eignvectors
If you multiply both sides by inv(D) we will have: B*w = inv(D) * A * B So you can use: [w, invD] = eig(B, A); D = inv(InvD)...

etwa 4 Jahre vor | 0

Beantwortet
Compute the summation of all elements square of matrix
% simply use sum(a(:))

etwa 4 Jahre vor | 0

Mehr laden