Réponse apportée
Euler Method for vector function
It appears to me that you want this: clear clc close all % step size h = 0.1; % final time Tf = 5; x = 0:h:Tf; yexact...

environ 3 ans il y a | 0

Réponse apportée
Matlab Code to calculate total energy consumed in given time.
Energy is just an integral of power over time. You can use cumtrapz function. This is probably what you need: A = xlsread('X_F...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
Basic Matlab to python question
This is what you probably want: import numpy as np arr = np.array([1, 2, 3, 4, 5]) arr2 = np.arange(0,10,2) print(arr) ...

environ 3 ans il y a | 0

Réponse apportée
Unexpected output from simplify()
It is probably because you he a division by vc in your expression. .../(vc^2)... This means simplified expression is valid onl...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
How to change element position in matrix?
Please use Matlab built in function called: circshift for example: A=[1;1;0;0;1;0;1] B = circshift(A, [-1, -1])

environ 3 ans il y a | 0

| A accepté

Réponse apportée
How to rotate a vector
If you want to reverse elements, then just use flip function. v = 1:10 v_f = flip(v)

environ 3 ans il y a | 1

| A accepté

Réponse apportée
How to name axes from the script
I would do ike this: x = linspace(0, 50); y = sin(x); plot(x,y); input_x = input('Enter name for x label:','s'); input_y = ...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
Calculate number appearance within a range
Perhaps this code snippet will help you: load TT classes = [1 2 10 20 50 100]; tol = 1e-10; res = zeros(size(diff(classes)...

environ 3 ans il y a | 0

Réponse apportée
How to remove all for-loops with vectorization?
This code should give you a pretty good idea how to do this: clear clc u=[35 75 -35 -75 0.3 0.5]; b=u; K=length(u)/3;% C...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
Defining and plotting a piecewise function of irregular interval
You can try something like this: syms x %makes x a symbolic variable f = piecewise(x>=0 & x<1/4, 1, x>=1/4 & x<1/2, 4*x.^2, x>...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
How do I create a function, save it, then run feral on it?
I understand this is homework, but you need to know that feval is not really necessary. Evan matlab suggest that. You can use t...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
HOW to convert negative integer to bit in Matlab?
Wel, you can use something like this (assuming you're working strictly with integers): s = -10 b = dec2bin(typecast(int8(s),'u...

environ 3 ans il y a | 0

Réponse apportée
Depth first search algorithm
Use built in function: https://www.mathworks.com/help/matlab/ref/graph.dfsearch.html

environ 3 ans il y a | 1

Réponse apportée
2 axis plotting with different markers
If you want to have legend only on points 'o' in both red and blue lines, I would do this: %plotting % I want to plot two axi...

environ 3 ans il y a | 0

Réponse apportée
Need to implement a bandpass filter on the ECG signal using matlab
Please have a look at the file exchange. For example: https://www.mathworks.com/matlabcentral/fileexchange/49822-open_ecg-ecg...

environ 3 ans il y a | 0

Réponse apportée
2 axis plotting with different markers
I would do somthing like this: %plotting % I want to plot two axis with different markers for lambda_r (hollow marker)and alp...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
Function inside a for loop
For loop will be executed in a matter of milliseconds. On the other hand when you call function once at a time, there is a signi...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
Precision and indices must be positive integers
The problem is in the line: kd = (Ppeak-0)/(times(end) - t); times is a built in Matlab function for element wise multiplicat...

environ 3 ans il y a | 0

Réponse apportée
What is wrong with my code?
In the line inside the function: term(k) = pi/(12+ k^b); but you didn't send b as an input parameter nor did you define it ins...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
I can not use i j k as a sym type what should I do
This is how I would solve this problem: c1 = test() function c1 = test() syms x y z k real i = sym('i'); j = sy...

environ 3 ans il y a | 0

Réponse apportée
Is this proper use of backward difference approxiamation?
The difference can be best seen on an example: h = 0.1; x = 0:h:6; F = sin(x); x_fw = x(1:end-1); dF_fw=(F(2:end)-F(1:end...

environ 3 ans il y a | 0

Réponse apportée
How to take first and second order derivative of discrete data?
Hello Ying, you wrote that second derivative of signal 2 looks weird. I assume that is ddCl (also based on how plot looks like)...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
How to calculate differential of scattered data?
Okay, here's what I do in order to avoid calculating derivation on the discrete data, especially when I know that they represent...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
Please help me...
I can only imagine that you're trying to do something like this: n = 3; A = randn(n); A = A'*A; [V, D] = eig(A); X = ze...

environ 3 ans il y a | 0

Réponse apportée
Please help me...
First of all, you need to read this: https://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-ans...

environ 3 ans il y a | 1

Réponse apportée
How can I call my function myfourier again with inputs specified and not entered from the user?
If I understood your question correctly, sometimes you want to call a function when user needs to enter inputs, and sometimes yo...

environ 3 ans il y a | 0

Réponse apportée
Transfer function to filter signal Simulink to Matlab
This shouldn't be a big problem in Matlab code. The most work is in defining input signal. Here's one example: close all clc ...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
A table of y versus t every 1 second.
I would do somthing like this: % assuming t and y are row vectors M = [t.',y.']; T = array2table(M); T.Properties.VariableNa...

environ 3 ans il y a | 0

Réponse apportée
How to corrplot without displaying histograms?
Please execute this script. I think it will give you pretty good idea what to do next. clear close all load Data_Canada corr...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
3d plot with x value being constant
p5x= p1x*ones(z);

environ 3 ans il y a | 0

| A accepté

Charger plus