when I change the spacing in linspace, that change my plot values drasticaly

3 visualizaciones (últimos 30 días)
this is part of my code
syms x;
w=symfun(2*pi*x,x);
%%%%%%
f = linspace(10,500,490);
%Electrico
Lvc=0.00145;
Rvc=5.5;
Red=3.9;
%Mecanico
Mmasa=9.74999*(10^-2);
Rm=58.1;
Fo=40;
%Constantes
BL=19.2;
Dspeaker=0.335;
%parametros
Fmin=10;
Fmax=500;
RadioSpeaker=Dspeaker/2;
AreaSpeaker=(RadioSpeaker^2)*pi;
Girador=BL^2;
TransGirador=Girador/((AreaSpeaker)^2);
Cm=(((2*pi*Fo)^2)*Mmasa)^-1;
%I0
Ibobina=1i*w*Lvc;
I0=(((Ibobina^-1)+(Rvc^-1))^-1)+Red;
%I1
Imasa=Girador*((1i*w*Mmasa)^-1);
IRmecanico=Girador/Rm;
Icompliancia=Girador*1i*w*Cm;
I1=((Imasa^-1)+(IRmecanico^-1)+(Icompliancia^-1))^-1;
%%%
Ielectrica=abs(I0+I1);%I0 and I1 depends of w
IelectricaPLOT=Ielectrica(f);
plot(IelectricaPLOT);
set(gca, 'XScale', 'log')
and with f = linspace(10,500,1000);

Respuesta aceptada

Image Analyst
Image Analyst el 1 de Mzo. de 2020
The signal value is the same, 10.28, but since you're plotting the x as the index, not some actual x value, the x value will of course change because you are changing the number of indexes. That's why you get 31 one time and 61 the next time. Makes perfect sense, don't you think?
If you don't want that, plot(x,y) instead of just plot(y) which will assume x as the index of the vector.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by