Beantwortet
Topographic map with gradient vector
You can look at this: https://www.mathworks.com/help/matlab/creating_plots/display-quiver-plot-over-contour-plot.html

etwa 4 Jahre vor | 0

Beantwortet
Using DisplayName Within a Loop
col_sim = {'-ro', '-bs', '-*k','-gx'}; % symbols for each curve of the plot (simulated data) col_exp = {'ro', 'bs', '*k',...

etwa 4 Jahre vor | 0

Beantwortet
finding the mean based on a specific value in other column
You can find the rows with the first condition and the other rows for the second condition. The intersection of the two rows, ar...

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
Why does my output turn out like this certain times I run my code?
in the first if statement, add a simi-colon ath the end: if (a>b) limit = b; end Also, you can simplify the firs...

etwa 4 Jahre vor | 0

Beantwortet
Function is not working
coror = relor + (relor - 180).*(relor > 90) + (relor + 180) .* (relor < -90);

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
frequency based on dictionary
you can use unique function along with badOfWords https://www.mathworks.com/help/textanalytics/ref/bagofwords.html

etwa 4 Jahre vor | 0

Beantwortet
What is the process in converting 45 mps to mph on matlab?
x = input('MPH value? '); % check 3.6? is it correct? y= x*3.6; printf ('kilometer per second %f\n',y) z=x.*2.23694; fprint...

etwa 4 Jahre vor | 0

Beantwortet
How can I assign a value to variable using buttons?
fig = uifigure; Bolt1 = uibutton(fig,'Text', 'Bolt 1','Position',[50,380, 100, 22],'ButtonPushedFcn', 'button_state=1;button_st...

etwa 4 Jahre vor | 0

Beantwortet
Loop Updating Vectors for Number of Iterations
Simply use A = [3 2 3; 5 5 6; 9 8 9]; b = [1; 2; 3]; x=b; for k=1:200 x=A\x; end

etwa 4 Jahre vor | 0

Beantwortet
how to correctly get values for stress for Y >82 values should be close to zero at Y = 88.25
You can use vectorized if statement: Q = Q2 .* (Y >= 82) + Q1 .* (Y < 82); stress = abs(V.*Q)/(i*t);

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
How do I write a script that calculates and prints all values ​​for N according to the following expressions and limits?
N=1; % sum function uses an internal loop % find the first N that sum is >= 1.6 while sum(1./[1:N].^2) < 1.6 N = N+1; e...

etwa 4 Jahre vor | 0

Beantwortet
After a certain time for loop speed slow down?
You can create A without having two nested loops: E0=10; [km, jm] = meshgrid(1:1000, 1:1000); A= E0*exp(-65*((km - 500).^2 +...

etwa 4 Jahre vor | 0

Beantwortet
Setting up equation with variables without values
Use (1/2)*Lp % instead of 1/2Lp

etwa 4 Jahre vor | 1

Beantwortet
Bisection method in matlab
clc clear lc=3; lp=3; w=160; T= 700; f=@(d) (w*lc*lp/(d*sqrt(lp^2-d^2)))-T; xl=input('enter the value for Xl '); xu=input(...

etwa 4 Jahre vor | 0

Beantwortet
How to find the index of the variable in my For Loop when a condition is met
[~,ind] = find(diff(nr)==0) % print indices for i = ind fprintf("%d is adjacent to a number of equal value\n", i) end

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to find the index of the variable in my For Loop when a condition is met
Use [nf, ind] = find(nr == i); ind contains the index with the given condition

etwa 4 Jahre vor | 0

Beantwortet
How to plot the figure using Matlab ?
You can combine four plot commands or use four curves (lines) to plot it for example plot([0,1],[1,0],'r', [1,2,4,8],[0,-1,-2,...

etwa 4 Jahre vor | 1

Beantwortet
how to fit a signal using polynomial fit with hogher order?
try polyfit function: polyfit function

etwa 4 Jahre vor | 0

Beantwortet
How can i run my integer number from this question ?
You can convert the strinng to a double number then apply int8 or int16: int16(str2double(inputLetter))

etwa 4 Jahre vor | 0

Beantwortet
error using plot vectors must be the same length
try to use this line of code inside the loop. For now, the code returns a single point for error; for i=2:test_points x_rec(...

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to describe function with varying variables?
You can multiply the first equation by a vector that is 1 for t<=L/v and is zero when t>L/v h=(H/2)*(1-cos(2*pi*v*t/L)).*( t<=...

etwa 4 Jahre vor | 0

Beantwortet
How to save each loop data?
You can make a vector of points as here: c=3e8; %speed of light u=0; uv=[]; yv=[]; while u<(c) y=1/(sqrt(1-((u^2)/...

etwa 4 Jahre vor | 1

| akzeptiert

Beantwortet
How to solve 'vector must be the same length', 'functions behave unexpectedly' errors when graphing vector equation
in the first code, instead of x=3; use this one: x=3*ones(size(t));

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
Working with complex numbers in the Symbolic Math Toolbox. Why does angle(A) returns atan2(sin(alpha),cos(alpha)) instead of just alpha?
if you want to find the numerical value of alpha, one solution is to use double function: double(angle(A))

etwa 4 Jahre vor | 0

Beantwortet
Can I save a MATLAB variable generated by a function into another MATLAB function?
You can use global variables by this line of code in all functions that share the same variables: global var1 var2 var3

etwa 4 Jahre vor | 0

Beantwortet
Factorial without the Command
Using only basic operations: function f = Factorial(n) % % initial value, 0! and 1! f = 1; if n > 1 for i=2:n ...

etwa 4 Jahre vor | 0

Beantwortet
Factorial without the Command
function f = Factorial(n) % % if n = 0 || n = 1 f = 1; elseif n >= 1 f = n * Factorial(n-1); end

etwa 4 Jahre vor | 0

Beantwortet
Loop for creating Submatrix
It should not be two nested loops. You can use one loop that increases a counter. You can use this code that doesn't need a loo...

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to enter a function into matlab
H/2*sigma.*cosh(k.*(h+z))./sinh(k.*h).*cos(k.*x-sigma.*t) H/2*sigma.^2.*cosh(k.*(h+z))./sinh(k.*h).*sin(k.*x-sigma.*t)

etwa 4 Jahre vor | 0

| akzeptiert

Beantwortet
Index in position 1 exceeds array bounds (must not exceed 2 )
try this for i = j:size(A,1)

etwa 4 Jahre vor | 0

Mehr laden