Solved


Roll the Dice!
*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

meer dan 4 jaar ago

Solved


Counting Money
Add the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99. E...

meer dan 4 jaar ago

Answered
problem to write a condition for 'if'
Try the following code: A = {[1,2,3,4], [1,2,3,6], [1,2,3,8], [1,2,6,7,8], [1,6,8], [2,3,4,7], [3,4,6], [3,4,6,7], [3,4,6,7,8],...

meer dan 4 jaar ago | 0

| accepted

Answered
control system bode plot
Try this: alpha=1;Wcr=10; syms w Mag(w)=piecewise(w<Wcr,20,w>=Wcr,-26.144+20*alpha*log(w)); w=logspace(-1,3,1000); semilogx...

meer dan 4 jaar ago | 0

| accepted

Solved


Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

meer dan 4 jaar ago

Solved


Weighted average
Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...

meer dan 4 jaar ago

Solved


radius of a spherical planet
You just measured its surface area, that is the input.

meer dan 4 jaar ago

Solved


Is this triangle right-angled?
Given three positive numbers a, b, c, where c is the largest number, return *true* if the triangle with sides a, b and c is righ...

meer dan 4 jaar ago

Solved


Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

meer dan 4 jaar ago

Solved


Length of the hypotenuse
Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle. <<http://upload....

meer dan 4 jaar ago

Solved


Find the alphabetic word product
If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ....

meer dan 4 jaar ago

Solved


Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

meer dan 4 jaar ago

Solved


Find the index of elements in a string vector
In the vector of v, find the index of elements specified by a. v = ["Lion","Koara","Elephant","Snake","Dog","Cat","Camel"]; ...

meer dan 4 jaar ago

Answered
How can I set linewidth directly in bode command?
You can try semilogx. See the following code: sys=tf(4,[1 0.5 4]); [mag,phase,wout] = bode(sys); Mag=20*log10(mag(:));Phase=p...

meer dan 4 jaar ago | 1

Answered
How to create a set of impulse values in a given set of timepoints in simulink
See the attached model. I run a simulation for 10 seconds and I create three impulses which appear at t=1, 3 and 6 respectively ...

meer dan 4 jaar ago | 0

| accepted

Answered
How to create initialize block on SIMULINK model corresponding with M-file
You can use Callback Function property of your Simulink model. You can find it in File->Model Properties->Callback Functions. He...

meer dan 4 jaar ago | 0

Answered
How can I sample n elements from each column of a matrix?
Following approach can be used(using for loop): n=2; for i=1:size(A,2) y(:,i)=randsample(A(:,i),n); end y

meer dan 4 jaar ago | 0

Answered
How to swap columns of a matrix??
Simple approach(Consider matrix A): A(:,[1 2 8 9])=A(:,[8 9 1 2])

meer dan 4 jaar ago | 1

| accepted

Answered
Solving trigonometric equations in MATLAB
Try the following code. It should help you: r1=1;r2=2;r3=3;r4=4;r5=5;%random values x1=100:1:126; syms x2 x3 for i=1:numel(x...

meer dan 4 jaar ago | 0

| accepted

Answered
why matlab always show my equation as matrix dimension
Try this: y = (668.061./x)*[-39-exp(-0.1468*x)]

meer dan 4 jaar ago | 0

Answered
Calculating a new variable from a symbolic equation
You already defined values for Q_full and Q. You do not need to define them as symbolic variables later. This will not work. Try...

meer dan 4 jaar ago | 0

| accepted

Answered
finding overlapping and non-overlapping values in matrix
Try the following code: A=[3 16 4 16;3 21 4 21;3 29 3 29;17 27 18 29;25 72 26 72;61 70 61 70;62 63 62 63]; Un=0; for i=1:size...

meer dan 4 jaar ago | 0

| accepted

Answered
Matlab function for cumulative power
Try the following code. By changing r and n values, you can see the corresponding results. r=9;n=4; A=zeros(n+1,n+1); for i=1...

meer dan 4 jaar ago | 2

| accepted

Answered
PID controller block in simulink
This PID is in ideal form. In PID block in Simulink, you can set the PID to be in ideal form and enter the parameters. See the a...

meer dan 4 jaar ago | 0

Answered
Ho do i convert this number to an integer?
Try vpasolve: w=1150;di=32.59;do=23.44; sol=vpasolve((w-(2.*90.*sind(b))).^2==(w-(90.*sind(b+di))-(90.*sind(b-do))).^2+((90.*c...

meer dan 4 jaar ago | 1

| accepted

Answered
please help me check the error
You forgot to put multiplication operator. Try this: function A=odd_rms(n) A=sqrt(mean((1:2:2*n-1).^2)); end

meer dan 4 jaar ago | 0

| accepted

Answered
How to plug in one value a time from a matrix into a function (WaitSecs)
It should look something like this: for k=1:numel(A) WaitSecs(A(k)) end . . .

meer dan 4 jaar ago | 0

| accepted

Answered
How can I resolve this?
Following code solves the problem. The command t(0)==0 does not make any sense since t is independent variable. Also, you used d...

meer dan 4 jaar ago | 0

| accepted

Answered
How to simulate simulink model in a given set of time-points only?
Yes, it is possible. Consider the attached Simulink model which contains a ramp block and its slope parameter is set as 5. Its s...

meer dan 4 jaar ago | 0

Load more